Choice of a deleted element at ListBox control
Posted
by Neir0
on Stack Overflow
See other posts from Stack Overflow
or by Neir0
Published on 2010-04-12T13:44:03Z
Indexed on
2010/04/12
16:23 UTC
Read the original article
Hit count: 535
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?
© Stack Overflow or respective owner