This question is locked. New answers and comments are not allowed.
Hello
I have a rad listbox which when someone clicks on an item if its already selected I need it to unselect. Also When a particular button is clicked I need everything to be unselected, but its not working! It leaves a black outline round the item and when I call the selected items in code its still selected!
I have taken my listbox and put it on a simple test form and it still does it!
Here is my code:
Please help!
What am I doing wrong!
Bex
I have a rad listbox which when someone clicks on an item if its already selected I need it to unselect. Also When a particular button is clicked I need everything to be unselected, but its not working! It leaves a black outline round the item and when I call the selected items in code its still selected!
I have taken my listbox and put it on a simple test form and it still does it!
Here is my code:
private int selectedIndex; | |
public TEST() | |
{ | |
InitializeComponent(); | |
} | |
private void radListBox1_SelectedIndexChanged(object sender, EventArgs e) | |
{ | |
int newIndex = radListBox1.SelectedIndex; | |
if (newIndex == selectedIndex) | |
{ | |
DeselectAllElements(); | |
} | |
else | |
{ | |
selectedIndex = newIndex; | |
} | |
} | |
public void DeselectAllElements() | |
{ | |
radListBox1.ClearSelected(); | |
radListBox1.SelectedIndex = -1; | |
selectedIndex = -1; | |
} | |
private void TEST_Load(object sender, EventArgs e) | |
{ | |
string[] list = "blah1,blah2,blah4,blah5,blah6".Split(','); | |
radListBox1.DataSource = list; | |
} |
Please help!
What am I doing wrong!
Bex