如何将鼠标单击事件添加到标签? [英] How do I add a mouse click event to a label?

查看:71
本文介绍了如何将鼠标单击事件添加到标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用标签进行自定义关闭和最小化按钮,我正在尝试向两个标签添加一个点击事件,但我似乎无法弄清楚如何,甚至可以在WPF中向标签添加点击事件,还是有另一种
方式?

I am trying to make my own custom close and minimise buttons using labels, I'm trying to add a click event to both of the labels but I can't seem to figure out how to, is it even possible to add a click event to a label in WPF or is there an alternative way?

谢谢。

推荐答案

您可以使用MouseLeftButtonDown事件:

You can use the MouseLeftButtonDown event:

<Label MouseLeftButtonDown="Label_MouseLeftButtonDown">Test</Label>


这篇关于如何将鼠标单击事件添加到标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆