title: WPF SkiaSharp Canvas Click Mouse position
body: <p>Note:  This is a C# SkiaSharp WPF application.</p>
  <p>When I repaint my <code>SKCanvas</code> (which is the full width of my app), I record the width and height.  Ignore height for now.  On a 4K monitor the width is recorded correctly 3840 pixels (when maximised).</p>
  <p>When I click on the canvas far left, the mouse X position recorded is almost zero as expected.</p>
  <p>However, when I click on the far right of the canvas 2552 is given as the X position, not something near 3840 as I expected?</p>
  <p>This is the code I use to get the mouse position when it is clicked.</p>
  <pre><code>private void MyCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  {
      var pixelPosition = e.GetPosition(sender as SKElement);
      // ...
  }
  </code></pre>
  <p>and my XAML:</p>
  <pre><code>&lt;skia:SKElement
      Name=&quot;MyCanvas&quot;
      PaintSurface=&quot;MyCanvas_PaintSurface&quot;
      MouseLeftButtonDown=&quot;MyCanvas_MouseLeftButtonDown&quot;
      /&gt;
  </code></pre>
  <p>I also checked the width/height in the <code>SizeChanged</code> event of <code>MyCanvas</code> and that does NOT report 3840 either, it reports 2552 as the width?</p>
  <p>Any ideas why the reported width is 2552 whereas the actual width is 3840?</p>