Reputation: 34780
I have an editor where the user selects a photo from a listbox in SL4, and edits the values like title, description, tags in a panel next to the list. The textboxes have Binding
is XAML to the listbox's SelectedItem
's appropriate properties, and it works nice. However, I want to be able to select multiple photos at the same time, and say, set tags of each. I don't know the exact name of the problem but I tried to explain, it is a very basic functionally in any software, select multiple items and edit a property, and it will be edited for all of them. If the properties are different, the textbox would display (multiple values)
and if I don't touch the field, nothing happens to those fields. Is this possible in XAML? I'm pretty sure up until SL version 4 is released, Microsoft guys would have thought a clever solution to this multiple-selection problem. If yes, how (please, XAML and Binding based declarative as possible or everything easily gets messed up). If there is no starightforward way, what is the cleanest/best practice of doing this?
Upvotes: 0
Views: 486
Reputation: 1005
You can use ListBox.SelectedItems
to enumerate and change the property of each item in the selected list. The ListBox
should have SelectionMode as Multiple
.
Its not a proper way to bind multiple items properties to a textbox, as we don't know what to show when these items have different values, & its better to have ListBox, and all its properties binding to a collection and its properties
Upvotes: 1