开发者

DataGrid , TextBox - binding and instant updates

My app. contains the window in the picture:

DataGrid , TextBox - binding and instant updates

The ItemsSour开发者_如何学Cce of the DataGrid is set to _editList ( declared as IList < Vendor > _editList;).

The data grid is set to Read Only.

The Vendor Name text box has the binding set as : Text="{Binding ElementName=dataGridVendors, Path=SelectedItem.Name, Mode=TwoWay}"

This works well. However, as it is the Vendor Name cell only updates when the user is done typing in the Vendor Name textbox and clicks on something else. Say I want to change the vendor name to "John Lennon II" . I have to click on the textbox and type the characters I want to add and than I have to click on something else and only then the datagrid makes the update.

I want to make the update happen as the user types the characters....Is this possible ?

Regards, Sebastian


Add the UpdateSourceTrigger to your Binding

Text="{Binding ElementName=dataGridVendors, Path=SelectedItem.Name, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}"

Its default trigger is lost focus. When you change it to PropertyChanged the Updates will done when you're typing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜