开发者

WPF DataGridTextColumn UpdateSourceTrigger=PropertyChanged does not work

开发者 https://www.devze.com 2023-03-15 12:27 出处:网络
I know this is a known problem. What I want is that the data source is updated as the user types. You can do this with a DataGridTemplateColumn which wraps around a TextBox, but this results in a perf

I know this is a known problem. What I want is that the data source is updated as the user types. You can do this with a DataGridTemplateColumn which wraps around a TextBox, but this results in a performance hit, DataGridTextColumn is a lot more efficient.

I have already extended Dat开发者_StackOverflowaGridTextColumn but there are no events I can use to get the functionality I desire.

Is there anything I can do?

Kind regards, Fugu

edit: As requested here is a XAML snippet:

Here is the DataGrid:

<UserControls:CommandDataGrid Name="dgCLASS_MN" 
Command="{x:Static my2:Commands.ClassVRPopulateCommand}"
AutoGenerateColumns="false"
DataContext="{StaticResource ResourceKey=ClassViewModel}"
ItemsSource="{Binding Path=MainTableView}"
SelectedItem="{Binding Path=MainTableSelectedRow}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
ClipToBounds="True"
SelectedCellsChanged="SelectedCellsChanged">

And here is one of the columns.

<UserControls:FreezableDataGridTextColumn Header="BASE_LANGUAGE_NAME" 
    SortMemberPath="BASE_LANGUAGE_NAME" Binding="{Binding Path=BASE_LANGUAGE_NAME, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

FreezableDataGridTextColumn descends from DataGridTextColumn which poses the same problem.

The DataGrid is bound to a DataTableView in the code behind.

0

精彩评论

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