如何在可编辑的Wpf Combobox上使用更新源触发器?

Rel*_*ity 4 wpf combobox mvvm updatesourcetrigger

我有一个组合框(在我的wpf-mvvm应用程序中).我已经定了IsEditable = true.但是当我开始打字时,"财产改变事件"就被解雇了.

我怎么能UpdateSourceTrigger = Propertychanged在这里设置?

另外..如果用户输入了新值,我需要调用验证函数(我的意思是除了列表中可用的那些...使用编辑功能).

任何帮助将不胜感激.

    <ComboBox ItemsSource="{Binding Path = PlanTypeBasedContractNumberList }" Width="90" IsEditable="True"  
SelectedValue="{Binding GeneralCharacteristicsDataContext.ContractNumber.Value}">
                            </ComboBox>
Run Code Online (Sandbox Code Playgroud)

Ric*_*key 7

在可编辑的情况下ComboBox,SelectedItemSelectedValue属性引用的是Popup项目,而不是可编辑的项目.一旦你开始输入,它SelectedItem就会变成"未被选中",这就是事件发生的原因.

要绑定到的价值TextBoxComboBox,使用Text属性:

<ComboBox IsEditable="True" Text="{Binding Path=..., UpdateSourceTrigger=...}">
Run Code Online (Sandbox Code Playgroud)