开发者

Why does nothing in WPF have a click event?

开发者 https://www.devze.com 2023-01-01 23:09 出处:网络
This seems v开发者_如何学运维ery strange to me. I know through some adventurous inheritance you can convert most UIElements to a button, but it is a cumbersome way of implementing the most basic of o

This seems v开发者_如何学运维ery strange to me.

I know through some adventurous inheritance you can convert most UIElements to a button, but it is a cumbersome way of implementing the most basic of of computer events


The ButtonBase class certainly has a Click event. So has derived classes.


I think the most basic events are MouseDown and MouseUp which are available to every UIElement


use RoutedEvents event if you really need to use. Other wise use dependency property to register a Click event against your control and then do what ever you want to do.


You can add RoutedEvents to your controls.

Here is an implementation example

0

精彩评论

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

关注公众号