WPF canvas

0

Witam, chciałbym w jednym buttonie odnieść się do jego pozycji w canvasie.

 
 <Button x:Name="button2" Canvas.Bottom="20" Canvas.Right="20" Height="{Binding ElementName=button1, Path=Height, UpdateSourceTrigger=PropertyChanged}" Width="{Binding ElementName=button1, Path=Width, UpdateSourceTrigger=PropertyChanged}" Content="button2"/>
        <Button x:Name="button3" Width="{Binding ElementName=button2, Path=Width, UpdateSourceTrigger=PropertyChanged}" Height="50" Content="button3" Canvas.Right="{Binding ElementName=button2, Path=Canvas.Right, UpdateSourceTrigger=PropertyChanged}" Canvas.Bottom="40"/>

Path=Canvas.Right nie działa poprawnie, w jaki sposób jest szansa dostać się do tej właściwości?

0

chciałem w xamlu, aby zero kodu behind

0

Że coś takiego ?

<Canvas>
            <Button x:Name="button2" Canvas.Bottom="20" Canvas.Right="20" Height="{Binding ElementName=button1, Path=Height, UpdateSourceTrigger=PropertyChanged}" Width="{Binding ElementName=button1, Path=Width, UpdateSourceTrigger=PropertyChanged}" Content="button2"/>
            <Button x:Name="button3" Width="{Binding ElementName=button2, Path=Width, UpdateSourceTrigger=PropertyChanged}" Height="50" Content="button3" 
                    Canvas.Right="{Binding Path=(Canvas.Right), ElementName=button2, UpdateSourceTrigger=PropertyChanged}" Canvas.Bottom="40"/>
        </Canvas>
0

ok a wytłumacz czemu w nawiasie zadziałało? Path=(Canvas.Right)

0

dzięki

1 użytkowników online, w tym zalogowanych: 0, gości: 1