I’m just trying to experiment some ListBox functionality in the SelectionChanged event.
I have the following controls:
1.ListBox : Name = ListBoxSource (I just added the Image in XAML)
2.ListBox : Name = ListBoxDisplay
I just want to iterate and get those items selected from ListBoxSource and display it to ListBoxDisplay. How to do that in the Loop?
The Items on the ListBoxSource are only Image controls and no other controls.
I cannot find any solutions on the net because most of the examples/solutions are using TextBlock, TextBox, or CheckBox …and no Images.
foreach (Object selectedItem in ListBox1.SelectedItems)
{
// What to do in here to add the selected Images to "ListBoxDisplay"
}
Use this
instead of all that code.
Also: Use a DataTemplate and DataBinding to fill the ListBoxes that will make this construction much more robust and flexible.