How to find the ParentComboBox of a ComboBoxItem?

前端 未结 2 387
悲&欢浪女
悲&欢浪女 2021-01-20 02:09

How can I get the ParentComboBox of an ComboBoxItem?

I would like to close an open ComboBox if the Insert-Key is pressed:

 var focusedElement          


        
2条回答
  •  情歌与酒
    2021-01-20 02:35

    As H.B. wrote you also can use

    var parent = ItemsControl.ItemsControlFromItemContainer(comboBoxItem) as ComboBox;
    

提交回复
热议问题