开发者

Choice of a deleted element at ListBox control

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=Sele开发者_如何转开发ctedItem}"
              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?


Your question is closely related to WPF ListView SelectedItem is null

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜