开发者

Make ListView ignore rightclick totally

开发者 https://www.devze.com 2023-01-10 00:14 出处:网络
I\'am just coding some global gesture handlers for a wpf application. For example I am supposed to use right click as a trigger to proceed UI.

I'am just coding some global gesture handlers for a wpf application. For example I am supposed to use right click as a trigger to proceed UI.

<Window.InputBindings>
        <MouseBinding MouseAction="Ri开发者_如何学JAVAghtClick" Command="NavigationCommands.NextPage"/>
</Window.InputBindings>

But now the problem appears that <ListBox/> consumes all mouse button events. I did some research but didn't found an easy way to make it just be unaware of the right button. Did anybody ever had this problem and found a solution? Thanks in advance.


You should be able to prevent the ListBox from consuming the mouse clicks using the following:

<ListBox>
        <ListBox.InputBindings>
            <MouseBinding MouseAction="RightClick" Command="ApplicationCommands.NotACommand" />
        </ListBox.InputBindings>
    </ListBox>
0

精彩评论

暂无评论...
验证码 换一张
取 消