我有一个列表框绑定到列表 . 该列表包含绑定到列表的字段/成员的复选框 . 我想要实现的是,当我选中相应的复选框时,我想从列表中删除数据 .
这是我的xaml代码:
<ListBox Name="ListBox1" ItemsSource="{Binding histList, Mode=OneWay}" Margin="10,10,10,10" Height="197" VerticalAlignment="Center" >
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding FilterName, Mode=TwoWay}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
这是.cs文件中的代码
namespace ReportsUIScreens
{
public partial class EditStyle : ChildWindow
{
private List histList;
public EditStyle(List histListLink)
{
InitializeComponent();
histList = histListLink;
this.ListBox1.ItemsSource=histList;
}
private void OKButton_Click(object sender, RoutedEventArgs e)
{
//HERE'S WHERE I WANT TO DELETE
this.DialogResult = true;
}
.........
.........
.........
}
}