开发者

DataGridCheckBoxColumn updates source and is validated only after focus loss

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 UpdateSourceTrig开发者_StackOverflow中文版ger 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?


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> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜