Rocky Rocky - 7 months ago 37
C# Question

how to make checkbox check and uncheck wpf

I have taken checkbox in datagrid

<CheckBox x:Name="chkActive" IsChecked="{Binding Active, Mode=TwoWay}"
Style="{StaticResource checkboxStyleNormal}" IsEnabled="True"/>

and binding the datagrid

datagrid1.ItemSource = dtData.DefaultView;

In datatable I am getting Active as
, I want to show my check box checked when
Active = 0

Grid is binding but I am unable to bind checkbox.

Some one please tell me how to show checkbox check/uncheck based on my condition.


I tried by modify my query before binding to the datagrid and added "case" to my query

Select ID ,DESC, CASE WHEN [STATUS] = 0 THEN 'True' WHEN [STATUS] = 1 THEN 'False' END AS  [Active], ORDER [Order] from tbldesc

its working fine for me.