2

リストにバインドされたリストボックスがあります。リストには、リストのフィールド/メンバーにバインドされたチェックボックスが含まれています。私が達成したいのは、対応するチェックボックスがチェックされているときにリストからデータを削除したいということです。

ここに私の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 ファイルのコードは次のとおりです。

名前空間 ReportsUIScreens
{
    パブリック部分クラス EditStyle : ChildWindow
    {
        プライベート リスト histList;
        public EditStyle(List histListLink)
        {
            InitializeComponent();
            histList = histListLink;
            this.ListBox1.ItemsSource=histList;
        }

        private void OKButton_Click(オブジェクト送信者, RoutedEventArgs e)
        {
            //ここで削除したい
            this.DialogResult = true;
        }
        .........
        .........
        .........
    }
}
4

0 に答える 0