By doing either an Items.Add() or Items.AddRange() call, is there a way to automatically set SelectedIndex to 0 if it is set to -1?
My first guess would be to create a new event that listens to a change in the Items property.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are not willing to set
SelectedIndex = 0after theAdd(which I personally do not think is too tedious…but to each their own), then you could try creating a custom control that will do this for you. However, there is no event for when an item is added, so you would have to create a new method.Ultimately, this seems like a bit of overkill, but it is doable this way.