Change propety Canvas.Left and Canvas.Top in codeb

2020-07-06 05:01发布

<Button x:Name="PlayButton" Content="Play" Canvas.Left="570" Canvas.Top="36" Height="51" Width="202" Background="#FF8898F9" />

How change Canvas.Top and Canvas.Left property of PlayButton in the code?

2条回答
Melony?
2楼-- · 2020-07-06 05:42
Canvas.SetLeft(PlayButton, 100);
Canvas.SetTop(PlayButton, 50);
查看更多
冷血范
3楼-- · 2020-07-06 05:44

Canvas class has SetTop and SetLeft static methods that set these attached properties:

Canvas.SetTop(PlayButton, 36);
Canvas.SetLeft(PlayButton, 750);
查看更多
登录 后发表回答