發問發問
 

問題How can I focus a particular item in ListBox in WPF

  • Wednesday, 20 May, 2009 9:59narmishaba 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hi,

      I have a listBox whose elements are binded using ItemsSouce.
    Now in the code behind I want to move the focus to the 3rd item in the listbox.
    Can somone tell me as to how can I acheive this?
    I think that once we get the access to listboxItem than we can easily set the focus by calling <listboxitem>.Focus(). But now the question is how can I get a particular ListBoxItem object for a binded ListBox?

    Even though it looked quite obvious to me, I didnt found a solution.