1つの監視可能なコレクションをSilverlightの1つのリストボックスにバインドしました。リストボックスの1つのアイテムをクリックし、[削除]ボタンをクリックすると、mvvm.iを使用してlinqを使用せずにその特定のアイテムをリストボックスから削除する方法がリストボックスitemidに渡されます。
<ListBox ItemsSource="{Binding School1,Mode=TwoWay}" DisplayMemberPath="SchoolName" Name="listBox1" >
<Button Content="Delete" Command="{Binding deletecommand}" CommandParameter="{Binding Path=SelectedItem.ID,ElementName=listBox1}" Name="button2" />
したがって、監視可能なコレクションから特定のアイテムを削除するためのコードは何ですか
public void delete(object parameter)
{
School1.Remove(...)
}