簡體   English   中英

WPF組合框將所選項目設置為失去焦點

[英]WPF combobox set selected item on lost focus

我有:

<Combobox ItemsSouce="{Binding SomeCollection}" SelectedItem="{Binding SomeItem}" />

我的財產SomeItem看起來像:

public object SomeItem 
{
    get
    {
       return _someItem;
    }
    set
    {
        LogMessage("SomeItem has changed to" + value);
        _someItem = value;
        OnPropertyChanged("SomeItem");
    }
}

當用戶滾動組合框時,如何防止調用set方法? 當組合框失去焦點時,我想調用該set方法。

嘗試將updatesource觸發器設置為在綁定中失去焦點。

<Combobox ItemsSouce="{Binding SomeCollection}" SelectedItem="{Binding SomeItem, UpdateSourceTrigger=LostFocus}" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM