WPF - MVVM - ComboBox SelectedItem

前端 未结 4 641
春和景丽
春和景丽 2021-02-07 05:21

I have ViewModel(implemented INotifyPropertyChanged) in the background and class Category which has only one property of type string

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 05:44

    If Combobox is bound to object class of the View Model, while the SelectionBoxItem of the sender object (in the SelectionChanged in code behind) has not that type, it means it's still loading.

    ComboBox combo = sender as ComboBox;
    if (combo.SelectionBoxItem.GetType() == typeof(BindedClass))
    {
                // Not loading
    }
    

提交回复
热议问题