Last Updated: February 25, 2016
· davidcorne

WPF control with fixed place buttons

By this I mean you want a scalable WPF control which has controls which stay in the same place the background. For instance buttons on the same place on an image. This is important with different monitor resolutions etc.

Use a Canvas inside a Viewbox! For example a button on an image.

<Viewbox Stretch="Uniform">
        <Image Source="Foot.png"/>
        <Canvas Name="KeyPointsFoot">
          <Button Background="Transparent" Canvas.Left="168" Canvas.Top="418" Width="80" Height="80">
              <Image Source="Button.png"/>

There is an example project here