开发者

How can I get a button's location on the canvas in WPF?

开发者 https://www.devze.com 2023-02-11 00:34 出处:网络
I have a class that uses System.Windows.Controls.Button. What I want to do is to find the button location on the canvas.

I have a class that uses System.Windows.Controls.Button. What I want to do is to find the button location on the canvas.

Every开发者_JAVA百科 tutorial out there that i found always uses the commands for WinForms Button class (System.Windows.Forms.Button) that has a location property: bt.Location(Point). I can't change over my buttons so I need to find a way to get the button location with System.Windows.Controls.Button reference. Is there an easy way to do this?


If your button is on a Canvas, you can call Canvas.GetLeft and Canvas.GetTop.

0

精彩评论

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