Reputation: 13809
The XAML code:
<Canvas>
<Button x:Name="btnCanvasButton" Content="Canvas Button"
Canvas.Left="50" />
<Button x:Name="btnCanvasButton2" Content="Canvas Button 2"
Canvas.Top="25"
Width="{Binding Path=Canvas.Left, ElementName=btnCanvasButton}" />
</Canvas>
I want to bind btnCanvasButton2.Width
to btnCanvasButton.Canvas.Left
, but it's not working.
I also tried Path=Canvas.LeftProperty
, Path=Left
, Path=LeftProperty
, but no luck either.
Please advise. Thx.
Peter
Upvotes: 0
Views: 130
Reputation: 34349
You need to use parentheses to bind to an attached property.
You could try:
<Button x:Name="btnCanvasButton2" Content="Canvas Button 2"
Canvas.Top="25"
Width="{Binding Path=(Canvas.Left), ElementName=btnCanvasButton}" />
Upvotes: 3