Jon*_*len 5 data-binding wpf binding wpfdatagrid datagridcomboboxcolumn
这就是我要的:
这是我当前的代码,它填充组合框但不更新ClassA.ApplicationKey.
<DataGridComboBoxColumn
Header="Application"
SelectedItemBinding="{Binding ApplicationKey, Converter={gui:DebugConverter}}"
SelectedValuePath="ApplicationKey"
DisplayMemberPath="ApplicationName"
ItemsSource="{Binding Source={x:Static app:ApplicationLookup.GetAllOrNone}}"/>
Run Code Online (Sandbox Code Playgroud)
使用SelectedValuePath时,请使用SelectedValueBinding而不是SelectedItemBinding.
工作实例
<DataGridComboBoxColumn
Header="Application"
SelectedValueBinding="{Binding ApplicationKey}"
SelectedValuePath="ApplicationKey"
DisplayMemberPath="ApplicationName"
ItemsSource="{Binding Source={x:Static app:ApplicationLookup.GetAllOrNone}}"/>
Run Code Online (Sandbox Code Playgroud)