我在longlistselector中有一个项目。所以我试图从wp7 c#中的longlistselector中删除特定项目?从wp7中的longlistselector中删除特定项目
0
A
回答
0
你需要声明你的ItemSource为您longlistselector为类型的ObservableCollection,所以,当你,你会longlistselector响应的变化相应地修改你的ItemSource。
牛逼可能是你的自定义类型,例如:
//Photo is my custom class
ObservableCollection<Photo> photos;
示例代码:
//Declare itemsource
ObservableCollection<string> list;
//Bind to longlistselector dynamically somewhere in code
longlistselector.ItemSource = list;
//Add items into your source
list.Add("test1");
list.Add("test2");
list.Add("test3");
//Delete items
list.RemoveAt(input item index here);
//OR
list.Remove(item); //if you're able to retrieve item ref;
而在你的XAML:
//Notice the {Binding } syntax below for ItemSource property
<phone:LongListSelector ItemsSource="{Binding }" SelectionChanged="longListSelector_SelectionChanged" Name="longListSelector" />
希望它很适合你。
一个代码示例供参考:
http://code.msdn.microsoft.com/wpapps/LongListSelector-Demo-45364cc9
+0
Thanx男子它帮助:) –
0
相关问题
- 1. 从变量中删除特定项目...?
- 2. 从SharedPreferences中删除特定项目
- 3. 从LongListSelector中删除Sticky GroupHeader?
- 4. WP7工具包更新从LongListSelector中删除了GetItemsInView()
- 5. WP8:使用ContextMenu删除项目的LongListSelector
- 6. 删除列表中的特定项目
- 7. 删除数组中的特定项目
- 8. 不删除Arraylist中的特定项目
- 9. 删除Jcombobox中的特定项目
- 10. 如何从Spinner中的项目列表中删除特定的选定项目
- 11. 如何刷新LongListSelector删除项目
- 12. 从Python中的列表中的特定位置删除项目
- 13. 从BlockingCollection <>删除特定项目
- 14. 从隔离存储中的文件中删除特定项目
- 15. 删除删除特定集合项目
- 16. 删除Longlistselector中的选定元素?
- 17. 从特定键的NSMutableArray中删除项目
- 18. 从列表中删除特定于行的项目
- 19. 从ArrayList中删除具有特定名称的项目
- 20. 从json对象中删除特定的项目
- 21. 从Android上的ListView中删除特定项目
- 22. 从VB中删除项目
- 23. 从JLIST中删除项目
- 24. 从ItemsControl中删除项目
- 25. 从AutoPopulatingList中删除项目
- 26. 从GridView中删除项目
- 27. 从arraylist中删除项目
- 28. 从表中删除项目
- 29. 从RecyclerView中删除项目
- 30. 从项目中删除LaunchScreen.xib
展示你的工作.. –
份额的项目已进行创建。没有给出来源,我们不能回答你的问题。 –