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>
相关推荐
精明的身影3 天前
深入WPF -- Dispatcher(补)
wpf
云中飞鸿3 天前
该如何进行WPF界面设计
wpf
云中飞鸿5 天前
WPF分哪几块
wpf
newbe365245 天前
我们如何使用 impeccable 优化前端界面设计与实现稳定性
前端·人工智能·分布式·github·aigc·wpf
Chris _data23 天前
WPF 学习第三天 — Modbus RTU 串口通信
hadoop·学习·wpf
布吉岛的石头23 天前
Java 程序员第 43 阶段05:微服务整合大模型,跨服务调用架构设计实战,Seata分布式事务实战
wpf
步步为营DotNet23 天前
基于.NET Aspire 实现云原生应用的高效监控与可观测性
云原生·.net·wpf
芒鸽24 天前
HarmonyOS 分布式开发实战:设备协同、数据共享与跨设备迁移
分布式·wpf·harmonyos
Volunteer Technology24 天前
Flink状态管理与容错(二)
大数据·flink·wpf
happyprince25 天前
07_verl-Trainer模块详解
人工智能·架构·wpf·强化学习