C# ComboBox GotFocus

后端 未结 3 1847
-上瘾入骨i
-上瘾入骨i 2021-02-05 17:21

I have a C# ComboBox using WPF. I have code that executes when the ComboBox\'s GotFocus is activated. The issue is that the GotFoc

3条回答
  •  花落未央
    2021-02-05 17:40

    I'm not too hot on WPF; but if you're trying to detect changes to the list (click on new value etc) you can use SelectedIndexChanged events..

    On the other hand, if you really do want to know simply when the control is focussed, can you filter it by saying something like;

    if (combo1.Focused && combo1.SelectedIndex == -1)
    {
         ...
    }
    

    .. ? It really depends on what youre trying to detect, exactly.

提交回复
热议问题