change color of Datagrid text
-
Hello members, I have tables (DBTable) in SQL 2008 that contains two columns that look like this: Col1 Col2 0 1 0 1 1 1 1 1 0 1 I created a Silverlight application (BI -RIA and domain services) that populates the datagrid as follows MyCarsDomainContext context = new MyCarsDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesCompareQuery()); I would like to change the row background color (just the text color will work fine too) based on the value of Col1. If 0 then row is red, if 1 then row is blue Any help is greatly appreciated
-
Hello members, I have tables (DBTable) in SQL 2008 that contains two columns that look like this: Col1 Col2 0 1 0 1 1 1 1 1 0 1 I created a Silverlight application (BI -RIA and domain services) that populates the datagrid as follows MyCarsDomainContext context = new MyCarsDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesCompareQuery()); I would like to change the row background color (just the text color will work fine too) based on the value of Col1. If 0 then row is red, if 1 then row is blue Any help is greatly appreciated
-
Hello members, I have tables (DBTable) in SQL 2008 that contains two columns that look like this: Col1 Col2 0 1 0 1 1 1 1 1 0 1 I created a Silverlight application (BI -RIA and domain services) that populates the datagrid as follows MyCarsDomainContext context = new MyCarsDomainContext(); dataGrid1.ItemsSource = context.DBTables; context.Load(context.GetDBTablesCompareQuery()); I would like to change the row background color (just the text color will work fine too) based on the value of Col1. If 0 then row is red, if 1 then row is blue Any help is greatly appreciated
You can do this via the converter approach. Call the converter during binding and set data fore color to the respective color in the converter. A simple example here[^].
Apps - Color Analyzer | Arctic | XKCD | Sound Meter | Speed Dial