Click here to Skip to main content
14,825,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want set the color to cell in the datagrid from based on the value of sql database.I typed below code and execute it will run but it dose not show any color in the cell.I did not find the solution to this problem.Help me please

What I have tried:

<DataGrid Name="dg">
                <DataGridTextColumn Binding="{Binding Name}">
                <DataGridTextColumn Binding="{Binding Status}">
                         <Trigger Property="Text" Value="1">
                             <Setter Property="Background" Value="Blue"/>
                         <Trigger Property="Text" Value="2">
                             <Setter Property="Background" Value="Green"/>
Updated 16-May-17 7:58am
Michael_Davies 16-May-17 10:21am
Do not know if case makes a difference but you have Triggers and /triggers and Style.Triggers with style.Triggers, every online example I looked at has them correctly cased and works.

1 solution


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900