1

私はこのようにデータグリッドを埋めています:

 DataTable tableBig = new DataTable();

 public MainWindow() {
        PO3.DataContext = tableBig;
        tableBig.Columns.Add("test", typeof(SomeClass));
        tableBig.Rows.Add(new SomeClass());
 }

これは私のxamlです:

<DataGrid Name="PO3" HorizontalAlignment="Left"  Margin="323,281,0,0" VerticalAlignment="Top" ItemsSource="{Binding}" Height="134" Width="340">

そしてこれはクラスです:

 public class SomeClass {

    public static readonly DependencyProperty TagProperty = DependencyProperty.RegisterAttached(
        "Tag",
        typeof(object),
        typeof(SomeClass),
        new FrameworkPropertyMetadata(null));

    int intt = 0;

    public static object GetTag(DependencyObject dependencyObject) {
        return dependencyObject.GetValue(TagProperty);
    }

    public static void SetTag(DependencyObject dependencyObject, object value) {
        dependencyObject.SetValue(TagProperty, value);
    }

}

タグのプロパティに基づいて datagridcell 内の色を変更することは可能ですか? トリガーがあるかもしれませんが、わかりません。

4

0 に答える 0