删除ListBox DataBinding中的项目 [英] Remove item in ListBox DataBinding

查看:90
本文介绍了删除ListBox DataBinding中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图 删除
项目 from istbox
我可以 删除 如果 我将
添加到< INSERT "
,您可以在
中看到 我将
添加到< INSERT " 为其指定名称
但是 我这样做 " ADD" 将其设为
TEST.ItemViewModel



我需要 删除 项目
具有特定名称
你可以帮助我 或告诉我
哪里有 示例

Hi, I have a problem trying to remove an item from the istbox, only I can remove if do I add to "INSERT", as you can see in the example when do I add to "INSERT" assigns it the name, but when I do it "ADD "puts it as TEST.ItemViewModel.

I need to remove items with a particular name, you can help me or tell me where there is any example?

in  .xaml    

in .xaml   

< / DataTemplate >

< / ListBox.ItemTemplate >

< / ListBox >

in .cs

For ADD new

lstItemsToList.Items.Add(

lstItemsToList.Items.Add(

new ItemViewModel ()

newItemViewModel()

{

LineOne = value,

LineOne = value,

LineTwo = ""

LineTwo = "",

LineThree = " ApplicationIcon.png"

LineThree ="ApplicationIcon.png",

});

in .cs

For DELETE

For DELETE

lstItemsToList.Items.Remove(value);

lstItemsToList.Items.Remove(value);

使用INSERT添加新内容

For ADD NEW with INSERT

lstItemsToList.Items.Insert(i,value);

lstItemsToList.Items.Insert(i,value);

thnks:D

推荐答案

您好。您无法从列表框中删除项目直接,但您可以从集合中删除项目源绑定到。

Hi. You can not remove items from the listbox directly, but you can remove from the collection you bound the items source to.

列表框的Items属性与"Items"不同。你绑定的集合。

The Items property of the listbox is not the same as the "Items" collection you bound.


这篇关于删除ListBox DataBinding中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆