Choice of a deleted element at ListBox control
- by Neir0
Hi
I have created a listbox control with following DataTemplate
<DataTemplate x:Key="lb_Itemtemplate">
<DockPanel>
<TextBlock Text="{Binding}" DockPanel.Dock="Left" />
<Button DockPanel.Dock="Right" Template="{StaticResource ButtonTemplate }"
Width="20" Margin=" 0,1,1,10" >Delete </Button>
<Button DockPanel.Dock="Right" Template="{StaticResource ButtonTemplate }"
Width="20" Margin="0,1,1,10" >Highlight </Button>
</DockPanel>
</DataTemplate>
<ListBox Name="listBox1" Grid.Column="0" Grid.Row="1"
DataContext="{Binding ElementName=cb_fields, Path=SelectedItem}"
ItemsSource="{Binding Path=PositiveXPathExpressions}"
ItemTemplate="{StaticResource lb_Itemtemplate}" />
I want to delete element from "PositiveXPathExpressions" collection when user clicked on button "delete" but How i can decide which element i must to delete?