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>
相关推荐
上海物联网2 小时前
Prism Regions-自定义区域适配器实现开发者将任意 WPF 控件转换为可动态加载视图的区域容器
面试·wpf
Aevget1 天前
DevExpress WPF中文教程:Data Grid - 如何绑定到有限制的自定义服务(四)?
wpf·界面控件·devexpress·ui开发·.net 10
棉晗榜1 天前
wpf DataGrid控制列是否显示,DataGrid列不会触发Visibility的转换器
wpf
超级种码1 天前
Redis:Redis高可用——副本、哨兵和集群
数据库·redis·wpf
棉晗榜1 天前
wpf给Border添加闪烁边框
wpf
Derrick_itRose1 天前
DevExpress笔记WPF(2)Data Editors and Controls(基础编辑器)
笔记·编辑器·wpf
He BianGu1 天前
【笔记】WPF的Binding中AsyncState的使用方式
笔记·wpf
曹天骄2 天前
Cloudflare KV 使用教程(基于 Wrangler 项目)
wpf
摘星编程2 天前
Flutter for OpenHarmony 实战:Dialog 对话框详解
flutter·wpf
ou.cs2 天前
WPF TreeView 自动展开所有节点:附加行为(Attached Behavior)保姆级实现教程
c#·.net·wpf