<Button x:Name="PlayButton" Content="Play" Canvas.Left="570" Canvas.Top="36" Height="51" Width="202" Background="#FF8898F9" />
如何在代码中更改PlayButton的Canvas.Top和Canvas.Left属性?
2 个答案:
答案 0 :(得分:21)
Canvas
类有SetTop
和SetLeft
个静态方法来设置这些附加属性:
Canvas.SetTop(PlayButton, 36);
Canvas.SetLeft(PlayButton, 750);
答案 1 :(得分:4)
Canvas.SetLeft(PlayButton, 100);
Canvas.SetTop(PlayButton, 50);