Set Cursor Focus into Editable Combobox in WPF C#

后端 未结 3 1888
灰色年华
灰色年华 2021-01-14 02:48

I have editable combobox in WPF and I want to set focus from C#,

I am using Combobox.Focus(), but it shows only selection but I want edit option where user can star

3条回答
  •  心在旅途
    2021-01-14 03:23

    If I understand you correctly, you have following situation: you set focus to ComboBox and observe selected text inside editable area, but you want it to be empty with only blinking caret inside. If so, you can do it this way:

    ComboBox.Focus();
    ComboBox.Text = String.Empty;
    

提交回复
热议问题