|
-
Oct 25th, 2017, 12:29 AM
#2
Re: Unwanted trigger of an event.
If you add items directly to a ComboBox then no item is selected by default. If you bind a list then the first item is selected by default. There's nothing you can do about that. As you're doing, you must unselect that first item to clear the control.
The SelectedIndexChangedEvent is raised every time the value of the SelectedIndexChanged property changes. If an item is selected when you bind and then you clear the selection, the SelectedIndex property values changes twice. There's nothing you can do about that.
If what you actually care about is that the user has selected an item rather than that the SelectedIndex property value has changed then handle SelectionChangeCommitted rather than SelectedIndexChanged. It is only raised when a selection is made via the UI.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|