views:

28

answers:

1

I have a problem with DataGrid from WPFToolkit. My grid has DataGridCheckBoxColumn. When I change value of some cell in this column, validation and real source updating occures only after a cell has lost focus. So, if I change checkbox value in a cell and leave focus inside it, the property of a binded object wouldn't be changed.

Column's binding property UpdateSourceTrigger is set to PropertyChanged and Mode is set to TwoWay.

How can I make binding update my source object immediatly after a checkbox value has been changed?

+1  A: 

I don't know for the toolkit-version but with the .net4 version, the binding works as expected. Check your binding-declaration:

<DataGridCheckBoxColumn Binding="{Binding YourProperty,UpdateSourceTrigger=PropertyChanged}">

If it's a specific problem of the toolkit-version, create a DataGridTemplateColumn and place a CheckBox in the cell-or edit-template and declare the binding on the CheckBox-control. This will help.

<dg:DataGridTemplateColumn > 
       <dg:DataGridTemplateColumn.CellTemplate> 
             <DataTemplate> 
                    <CheckBox IsChecked="{Binding YourProperty,UpdateSourceTrigger=PropertyChanged}" /> 
             </DataTemplate> 
       </dg:DataGridTemplateColumn.CellTemplate> 
</dg:DataGridTemplateColumn> 
HCL