WPF: ComboBox with reset item

后端 未结 9 1924
长发绾君心
长发绾君心 2020-12-15 23:33

I want to make a ComboBox in WPF that has one null item on the top, when this gets selected, the SelectedItem should be set to null (reset to default state). I\

9条回答
  •  太阳男子
    2020-12-15 23:58

    Please use the following code.

        (None)
    

    In the viewmodel, catch the "ClearSelectedItems" change notification and clear the SelectedItems of ItemsControl.

提交回复
热议问题