开发者

Set focus in Listbox in MVVM pattern

I am trying to set a focus on the first Item of listBox. I am binding the value to listbox, contaning a textbox by a onpropertyc开发者_StackOverflow中文版hange method and I want to set focus in the first item. how can I achieve that?


you can set focus on the first item with the following:

listBox1.Items[0].Focused = true;

you may also want to have the item that is focused to be selected, if you do then:

listBox1.Items[0].Selected = true;

Just remember the [0] above means the first index. [1] would be the second and so on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜