Blog Archives

Quick Tip: a work around the RadListBox’s SelectedIndex issue with Telerik Q1 2013

If you are working with Telerik RadListBox for Silverlight or WPF and if you upgraded your Telerik version to the Q1 2013 , you probably noticed that there is something wrong with it.

Basically the problem is when SelectedIndex is changed , the SelectedItem property is not updated and vice versa.

A classic scenario is when you try to set a by default selection:

_myListBox.SelectedIndex = 0;

If(_myListBox.SelectedItem != null)

   {

       //Do something

   }

This is not working anymore with Telerik Q1 2013 because SElectedItem is not updated.

What you can do is instead of  _myListBox.SelectedIndex = 0;

put  _myListBox.SetValue(RadListBox.SelectedItemProperty, _myListBox.Items[0]);

 

Wala Sourire