I used a image in WPF. On top of the image开发者_运维技巧 I positioned labels. When resizing my window the image also resizes, which is ok. However the labels should also reposition. So they keep on the same relative position on top of the image. Currently I'm using a canvas. I set the Canvas.Top and Canvas.Left properties for the labels. How can I fix the positioning of the labels when resizing.
Use a Viewbox
and place your Canvas
inside the ViewBox
.
If you want put the label always on top of the image, simply use StackPanel
.
精彩评论