WPF ListBox双击事件

xml 复制代码
<ListBox
    Name="ListBox"
    Margin="5,5,5,5"
    ItemsSource="{Binding FileGroupList}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding GroupName}" TextTrimming="CharacterEllipsis" />
        </DataTemplate>
    </ListBox.ItemTemplate>
    <ListBox.ContextMenu>
        <ContextMenu>
            <MenuItem Header="修改文件名" />
            <MenuItem Header="批量修改文件名" />
            <MenuItem Header="移除" />
        </ContextMenu>
    </ListBox.ContextMenu>
    <hc:Interaction.Triggers>
        <hc:EventTrigger EventName="MouseDoubleClick">
            <hc:InvokeCommandAction Command="{Binding SpeDoubleClickCommand}" CommandParameter="{Binding ElementName=ListBox, Path=SelectedItem}" />
        </hc:EventTrigger>
    </hc:Interaction.Triggers>
</ListBox>

主要是

xml 复制代码
xmlns:hc="https://handyorg.github.io/handycontrol"


Name="ListBox"


<hc:Interaction.Triggers>
        <hc:EventTrigger EventName="MouseDoubleClick">
            <hc:InvokeCommandAction Command="{Binding SpeDoubleClickCommand}" CommandParameter="{Binding ElementName=ListBox, Path=SelectedItem}" />
        </hc:EventTrigger>
    </hc:Interaction.Triggers>
相关推荐
bugcome_com1 天前
WPF 命令 ICommand 从原理到实战
后端·wpf·icommand
武藤一雄2 天前
WPF处理耗时操作的7种方法
microsoft·c#·.net·wpf
Venom842 天前
我的 WPF Powermill 工具
wpf
一念春风3 天前
证件照制作工具(WPF C#)
c#·wpf
He BianGu4 天前
【笔记】在WPF中GiveFeedbackEventHandler的功能和应用场景详细介绍
笔记·wpf
就是有点傻4 天前
WPF自定义控件-水晶球
wpf
He BianGu4 天前
【笔记】在WPF中QueryContinueDragEvent的详细介绍
笔记·wpf
He BianGu4 天前
【笔记】在WPF中QueryCursor事件的功能和应用场景详细介绍
笔记·wpf
He BianGu4 天前
【笔记】在WPF中CommandManager的功能和应用场景详细介绍
笔记·wpf
关关长语4 天前
HandyControl中Button图标展示多色路径
c#·.net·wpf·handycontrol