我在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
展示你的工作.. –
份額的項目已進行創建。沒有給出來源,我們不能回答你的問題。 –