views:

24

answers:

1

For the WPF Image control, Horizontal alignment doesn't work.. Any ideas? I've pasted the exact code below.. the image appears in the middle..

<Canvas Canvas.Top="550" Canvas.Left="225" Width="500" Height="100">
  <Border BorderBrush="#323232" BorderThickness="75" Width="500" Height="100"></Border>
  <Image  Canvas.Left="0" DataContext="...." Source="...." HorizontalAlignment="Right" Height="75" Width="275"/>
</Canvas>
+4  A: 

Canvas uses the Left, Right, Top, Bottom settings to place children in a specific pixel location so Alignment settings on children with fixed size have no effect.

John Bowen
Thanks, do we have any workaround for this issue?
Vin
Don't use a Canvas for layout unless you want absolute positioning for all of its children. A Grid is probably more suitable for what you want here.
John Bowen