Tombstoning selected items of Multiselect List( wp7 mango tool kit control)
-
26-10-2019 - |
Question
How i can Tombstone the selected values of a multiselect list control. I retrieve the values of selected items by iterating through the statement [((System.Collections.Generic.List)(items))] , but i am flailed to reassign this values, any one please help me to solve this issue. It seems this is a blocking issue form me, only countable days left for my marketplace submission. So any one please help me to solve this issue.
Solution
if (selectedItems != null && selectedItems.Count > 0) {
wordlist.IsSelectionEnabled = true;
ObservableCollection<Word> wrdlst = new ObservableCollection<Word>();
var vm = this.DataContext as wordsListVM;
wrdlst = vm.WordsList;
ItemContainerGenerator itemContainerGenerator = this.wordlist.ItemContainerGenerator;
foreach (Word word in wrdlst) {
if (word != null) {
foreach (string wordId in selectedItems) {
if (wordId == word.Id) {
DependencyObject visualItem = itemContainerGenerator.ContainerFromItem(word);
MultiselectItem multiselectItem = visualItem as MultiselectItem;
if (multiselectItem != null) {
multiselectItem.IsSelected = true;
}
}
}
}
}
}
OTHER TIPS
Try listBox.SelectedItems.Add(item1);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow