DataGrid, TextBox - Binding and Instant Updates

My application. contains the window in the picture:

alt text

The ItemsGridGrid element is set to _editList ( declared as IList <Vendor> _editList; ).

The data grid is set to Read Only .

The "Provider Name" text box has a set of bindings like: Text = "{Binding ElementName = dataGridVendors, Path = SelectedItem.Name, Mode = TwoWay}"

It works well. However, since this "Supplier Name" cell is updated only when the user has finished entering the "Supplier Name" text box and clicks on something else. Say I want to change the vendor name to "John Lennon II". I have to click on the text field and type in the characters I want to add, and I need to click something else, and only then the datagrid will do the update.

I want the update to happen when the user enters characters ... Is this possible?

Regards, Sebastian

+6
wpf binding datagrid
source share
1 answer

Add 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, updates will be performed when you print.

+14
source share

All Articles