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>
相关推荐
TA远方1 小时前
【WPF】桌面程序使用谷歌浏览器内核CefSharp控件详解
wpf·浏览器·chromium·控件·cefsharp·cefsharp.wpf
Macbethad12 小时前
工业设备数据采集主站程序技术方案
wpf
关关长语21 小时前
HandyControl 3.5.x 版本 ListViewItem不显示问题
windows·wpf
Macbethad21 小时前
工业设备维护程序技术方案
wpf
Macbethad21 小时前
工业设备配方管理系统技术方案
wpf
喵叔哟1 天前
7.日志系统深入
wpf
清风徐来Groot1 天前
WPF布局之Grid
wpf
清风徐来Groot1 天前
WPF布局之WrapPanel
wpf
Macbethad1 天前
WPF工业设备工艺配方流程程序技术方案
wpf
清风徐来Groot1 天前
WPF布局之UniformGrid
wpf