How do you handle a ComboBox SelectionChanged in MVVM?

前端 未结 3 1970
南旧
南旧 2020-12-13 06:45

For those doing pure MVVM, how do you handle a ComboBox SelectionChanged event without reverting to code behind?

I tried e.g. AttachedBehaviors but Event=\"SelectedC

3条回答
  •  無奈伤痛
    2020-12-13 07:13

    You would use a data trigger to trigger an event on a different UI element such as "enable / disable, or visible /invisible"

    If you want the selected element to show the object data in other UI elements then you would use data binding and set the datacontext of the UI data display elements to be bound to the currently selected item in the combo box.

提交回复
热议问题