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>
相关推荐
要记得喝水1 天前
某公司WPF面试题(含答案和解析)--3
wpf
zzyzxb2 天前
WPF中Adorner和Style异同
wpf
棉晗榜2 天前
WPF锚点页面,点击跳转到指定区域
wpf
zzyzxb2 天前
Style/Setter、Template 属性、ControlTemplate 三者的关系
wpf
要记得喝水2 天前
某公司WPF面试题(含答案和解析)--2
wpf
zzyzxb2 天前
WPF中Template、Style、Adorner异同
wpf
小股虫2 天前
数据一致性保障:从理论深度到架构实践的十年沉淀
架构·wpf
廋到被风吹走2 天前
【Spring】PlatformTransactionManager详解
java·spring·wpf
源之缘-OFD先行者3 天前
全栈开发实战:WPF+FFmpeg+GIS,打造工业级雷达探测终端
ffmpeg·wpf
Poetinthedusk3 天前
WPF动画制作分享
wpf·动画