Questions marquées «attached-properties»


3
Changer la propriété Canvas.Left dans le code derrière?
J'ai un rectangle dans mon XAML et je souhaite modifier sa Canvas.Leftpropriété dans le code derrière: <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> Mais cela ne fonctionne pas: private void txt_KeyDown(object sender, KeyEventArgs e) { theObject.Canvas.Left = 50; } Quelqu'un …

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.