I have a listbox and a delete button.
The first item in the listbox should never be deleted and ive stopped that by disabling the button when the top item is selected.
the problem I have is that if the listbox contains multiple items and the user was to delete all those extra items they still need to click the top item in the listbox to disable the button.
this is less than ideal because if the user just clicks the button with just the top item leaved C# throws an unhanded.
My solution is to simply make it so when the delete button is pressed it automatically selects the top item in the list box after deletion, thus making it impossible to delete that top item.
After a google I came across
and the listBox1.SetSelected(4,true);
which would seemingly solve my problem and enable me to set the selected item, but my listbox seems to be missing this function.
Any reason for this?
Im using WPF .Net 3.5 and VS2010