So let say I have a custom class:
Class Elements{
int width;
int height;
bool isBol;
}
and in main I have something like:
Public class MainWindow{
DataGrid dgv = new DataGrid();
List<Elements> elem = new List<Elements() {
new Element(){width=100, height = 200, isBold = false},
new Element(){ width=20, height=100, isBold = true}
};
dgv.ItemsSource = elem;
dgv.Columns.Add(new DataGridTextColumn() {
Header = "Width", Binding = new Binding("width")}
dgv.Columns.Add(new DataGridTextColumn() {
Header = "Height", Binding = new Binding("height")}
}
So it is just a simple table with 2 columns, width and height.
How would I make a row appear to be bold based on the bool value isBold? In my example above, the row 20×100 should appear to be bold in the table, where 100×200 should NOT be bold.
Can I do this?
I would use a
DataTriggerin an ImplicitStyle