Change propety Canvas.Left and Canvas.Top in codebehind WinRT

泪湿孤枕 提交于 2020-03-18 11:30:36

问题


<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?


回答1:


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

Canvas.SetTop(PlayButton, 36);
Canvas.SetLeft(PlayButton, 750);



回答2:


Canvas.SetLeft(PlayButton, 100);
Canvas.SetTop(PlayButton, 50);


来源:https://stackoverflow.com/questions/21515135/change-propety-canvas-left-and-canvas-top-in-codebehind-winrt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!