Questions tagged «attached-properties»


3
在后面的代码中更改Canvas.Left属性?
我的XAML中有一个矩形,想Canvas.Left在后面的代码中更改其属性: <UserControl x:Class="Second90.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400" Height="300" KeyDown="txt_KeyDown"> <Canvas> <Rectangle Name="theObject" Canvas.Top="20" Canvas.Left="20" Width="10" Height="10" Fill="Gray"/> </Canvas> </UserControl> 但这不起作用: private void txt_KeyDown(object sender, KeyEventArgs e) { theObject.Canvas.Left = 50; } 谁知道这样做的语法是什么?


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.