Checkbox is not checked in DevExpress GridControl using wpf

checkbox, devexpress, gridcontrol, wpf

Solution

Adding on to HighCore's answer. If you would like to edit the data in your grid.

See ColumnBase.CellTemplate Property:

- To enable data editing, use an editor shipped with the DevExpress Data Editors Library for WPF. The editor's Name must be set to 'PART_Editor'.

- Standard controls can be used in CellTemplate only for display purposes. Data editing is not allowed.

Then,

xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 

<dxg:GridColumn Name="PickColumn" 
                Header="Pick" 
                Width="30" 
                AllowColumnFiltering="False" 
                AllowSorting="False">
    <dxg:GridColumn.CellTemplate>
        <DataTemplate>
            <dxe:CheckEdit x:Name="PART_Editor"
                           EditValue="{Binding Path=Data.IsValid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
        </DataTemplate>
    </dxg:GridColumn.CellTemplate>
</dxg:GridColumn>

You still need to use HighCore's implementation of `INotifyPropertyChanged`.

Problem

I am trying to work on DevExpress GridControl Checkbox column but problem is that when I binding the checkbox value in XAML code dynamically its not work perfectlly below I provide you my demo project code :- XAML Code:- ``` <dxg:GridControl AutoPopulateColumns="True" HorizontalAlignment="Left" Margin="0,40,0,0" Name="gridControl1" VerticalAlignment="Top" Height="318" Width="503"> <dxg:GridControl.View> <dxg:TableView Name="tableView1" ShowTotalSummary="True" /> </dxg:GridControl.View> <dxg:GridControl.Columns> <dxg:GridColumn DisplayMemberBinding="{Binding Path=EvenOdd}" Header="Even/Odd" /> <dxg:GridColumn Name="PickColumn" Header="Pick" Width="30" AllowColumnFiltering="False" AllowSorting="False"> <dxg:GridColumn.CellTemplate> <DataTemplate> <CheckBox IsChecked="{Binding Path=IsValid}" HorizontalAlignment="Center" VerticalAlignment="Center" > </CheckBox> </DataTemplate> </dxg:GridColumn.CellTemplate> </dxg:GridColumn> </dxg:GridControl.Columns> </dxg:GridControl> ``` my cs file code:- ``` public class ss { public bool IsValid { get; set; } public string EvenOdd { get; set; } } ``` Code Behind: ``` public List<ss> sList = new List<ss>(); private void Window_Loaded(object sender, RoutedEventArgs e) { for (int i = 0; i < 10; i++) { if (i % 2 == 0) { sList.Add(new ss { IsValid = true, EvenOdd = "Even" }); } else { sList.Add(new ss { IsValid = false, EvenOdd = "Odd" }); } } gridControl1.ItemsSource = sList; } ```

Original source