Formula una domandaFormula una domanda
 

DomandaHow can I focus a particular item in ListBox in WPF

  • mercoledì 20 maggio 2009 9.59narmishaba Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    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.