Freitag, 30. Juli 2010

Silverlight: Set Focus to selected item in Listbox

If you want to set the focus to the selected item in your Silverlight Listbox Control you have to use this dirty trick:

   1: int selectedIndex = itemsListBox.SelectedIndex;
   2:                itemsListBox.SelectedIndex = 0;
   3:                itemsListBox.Focus();
   4:                itemsListBox.SelectedIndex = selectedIndex;

Keine Kommentare:

Kommentar veröffentlichen