To retrieve a collection containing the indexes of all selected items in a multiple-selection List Box, use the property to move the currently selected item to the top of the list of items in the display area of the List Box.
The example further demonstrates how to remove items using the Remove At method of the System. Forms Object Collection class, and how to clear all item selection using the Clear Selected method.
So, I've decided to add a helper method to refresh a WPF control.
I really appreciated the Refresh method in Win Forms (which executes both Invalidate & Update), so I'm renaming my method to be Refresh as well.
The code snippet below also show some C# specific techniques, namely: anonymous delegates and extension methods.
This makes the databinding easier, since elements will walk up the element tree to find their datacontext.
This example requires that a List Box containing items is added to a form and that an item is currently selected in the List Box.
Sometime in the past, a friend asked me how to update a control to show status while his code is doing a loop of stuff.
When a Product is selected, the Combo Box should change the selection to align with the Category Parent property of the Product.
Changing the Selected Item in the Combo Box should update the Category Parent property of the Product.