Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I could reproduce the problem on my machine with emulator at display resolution of 2560x1440 with canvas as below.</p> <pre><code>&lt;Canvas Width="4" Height="4"&gt; &lt;Rectangle Width="4" Height="4" Fill="Blue" &gt;&lt;/Rectangle&gt; &lt;/Canvas&gt; </code></pre> <p>For above snippet - canvas overflows/goes-beyond the red panel.</p> <pre><code>&lt;Canvas Width="6" Height="6"&gt; &lt;Rectangle Width="6" Height="6" Fill="Blue" &gt;&lt;/Rectangle&gt; &lt;/Canvas&gt; </code></pre> <p>For above snippet - canvas underflows/does-not-fit the red panel, and leaves some space on right margin of the red panel.</p> <p>if the canvas size is kept multiple of 5, it fits properly in red panel. </p> <p>It does not seem to be an issue with Path since it reproduces with rect also. It seem to be issue with ViewBox scaling. I found that with <code>UseLayoutRounding="False"</code> on stackpanel - issues does not reproduce. I also found a <a href="https://stackoverflow.com/questions/1857289/why-does-uselayoutrounding-not-seem-to-work-with-viewbox">related thread</a> when looking around for ViewBox scaling issues. It suggest to use <code>SnapsToDevicePixels</code> property but that is not available for windows store xaml apps.</p> <p>In summary, it seem to be an issues with ViewBox scaling though I am not a pro with internal knowledge of viewbox scaling algo. Possible workaround is to set UseLayoutRounding to false if it passes the test on another machine. The multiple of 5 does not look like as good workaround but you can check. On a separate note - if you were just curious to know why it is happening, you get the answer and may be underflow/overflow of few pixels may out matter for your application.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload