Windows phone 7 删除Multiselect列表中的选定项(wp7 mango工具包控件)
如何对多选列表控件的选定值进行逻辑删除。我通过迭代语句[((System.Collections.Generic.List)(items))]来检索所选项的值,但我无法重新分配此值,请任何人帮助我解决此问题。这似乎是一个阻碍我的问题,我的市场提交只剩下几天了。所以任何人都可以帮我解决这个问题 尝试列表框。选择编辑项。添加(项1) 尝试列表框。选择编辑项。添加(项1)Windows phone 7 删除Multiselect列表中的选定项(wp7 mango工具包控件),windows-phone-7,windows-phone-7.1,Windows Phone 7,Windows Phone 7.1,如何对多选列表控件的选定值进行逻辑删除。我通过迭代语句[((System.Collections.Generic.List)(items))]来检索所选项的值,但我无法重新分配此值,请任何人帮助我解决此问题。这似乎是一个阻碍我的问题,我的市场提交只剩下几天了。所以任何人都可以帮我解决这个问题 尝试列表框。选择编辑项。添加(项1) 尝试列表框。选择编辑项。添加(项1) if(selectedItems!=null&&selectedItems.Count>0){ wordlist.IsSelect
if(selectedItems!=null&&selectedItems.Count>0){
wordlist.IsSelectionEnabled=true;
ObservableCollection wrdlst=新的ObservableCollection();
var vm=this.DataContext作为wordsListVM;
wrdlst=vm.WordsList;
ItemContainerGenerator ItemContainerGenerator=this.wordlist.ItemContainerGenerator;
foreach(wrdlst中的单词){
如果(字!=null){
foreach(selectedItems中的字符串wordId){
如果(wordId==word.Id){
DependencyObject visualItem=itemContainerGenerator.ContainerFromItem(word);
MultiselectItem MultiselectItem=visualItem作为MultiselectItem;
如果(multiselectItem!=null){
multiselectItem.IsSelected=true;
}
}
}
}
}
}
如果(selectedItems!=null&&selectedItems.Count>0){
wordlist.IsSelectionEnabled=true;
ObservableCollection wrdlst=新的ObservableCollection();
var vm=this.DataContext作为wordsListVM;
wrdlst=vm.WordsList;
ItemContainerGenerator ItemContainerGenerator=this.wordlist.ItemContainerGenerator;
foreach(wrdlst中的单词){
如果(字!=null){
foreach(selectedItems中的字符串wordId){
如果(wordId==word.Id){
DependencyObject visualItem=itemContainerGenerator.ContainerFromItem(word);
MultiselectItem MultiselectItem=visualItem作为MultiselectItem;
如果(multiselectItem!=null){
multiselectItem.IsSelected=true;
}
}
}
}
}
}
我说的是在“多选列表”中对选中的项目进行逻辑删除,在这种情况下,选中的项目将出现,这时您需要执行类似于foreach(逻辑删除选择中的变量项目)列表框的操作。SelectedItems.Add(项目);您首先必须将选择存储在某个位置,例如在page.State字典中,this.State[“ListBoxSelection”]=selection;以及后面的var tombstonedSelection=(List)this.State[“ListBoxSelection”];我所说的是在“multiselect list”中对选中的项目进行逻辑删除,在这种情况下,选中的项目将出现,这时您需要执行类似于foreach(逻辑删除选择中的var项目)listBox.SelectedItems.Add(项目)的操作;您首先必须将选择存储在某个位置,例如在page.State字典中,this.State[“ListBoxSelection”]=selection;以及后面的var tombstonedSelection=(List)this.State[“ListBoxSelection”];
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;
}
}
}
}
}
}