开发者

How to use update source trigger on Wpf Combobox which is editable?

开发者 https://www.devze.com 2023-02-05 23:54 出处:网络
I have a combo box (in my wpf-mvvm app). I have set IsEditable = true. But the \"property changedevent\" is getting fired when I start typing.

I have a combo box (in my wpf-mvvm app). I have set IsEditable = true. But the "property changed event" is getting fired when I start typing.

How can I set UpdateSourceTrigger = Propertychanged here ?

Also..I need to call a validation function if user has entered new value ( i mean other than those available in list ..using edit functiona开发者_开发知识库lity).

Any help will be appreciated.

    <ComboBox ItemsSource="{Binding Path = PlanTypeBasedContractNumberList }" Width="90" IsEditable="True"  
SelectedValue="{Binding GeneralCharacteristicsDataContext.ContractNumber.Value}">
                            </ComboBox>


In an editable ComboBox, the SelectedItem and SelectedValue properties refer to the Popup items, not the editable item. Once you start typing, the SelectedItem becomes "unselected" and that's why the event fires.

To bind to the value of the TextBox of the ComboBox, use the Text property:

<ComboBox IsEditable="True" Text="{Binding Path=..., UpdateSourceTrigger=...}">
0

精彩评论

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