1

I have a datagrid fill in this way:

 DataTable tableBig = new DataTable();

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

this is my xaml:

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

and this a class:

 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);
    }

}

It's possible to change color inside a datagridcell based on tag property? maybe with a trigger, but I don't know.

4

0 回答 0