Note that there are some explanatory texts on larger screens.

plurals
  1. POItems not drawing on Resize of Viewbox, Silverlight
    primarykey
    data
    text
    <p>I am currently designing a layout app in Silverlight and have a <code>Canvas</code> inside of a <code>Viewbox</code>. I add shapes to the canvas and they display properly, when I resize the viewbox to zoom in at 2x the height and width, everything still draws properly.</p> <p>The problem comes when I try to zoom at a factor of <code>4</code> or greater or at <code>0.5</code> (zoomed out).</p> <p><strong>Update</strong>: The horizontal lines are still there, they are just not drawing. Interaction between the the other shapes and the disappearing ones is still present</p> <p>When I do this, any horizontal lines do not redraw, but any other shapes, vertical lines of other, still redraw fine. The objects are still children of the canvas and their visibilities are all set to visible. </p> <p>What is happening? </p> <p><strong>Update</strong><br> Very Simple XAML:</p> <pre><code>&lt;ScrollViewer x:Name="scrollViewer" Padding="0" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" IsTabStop="False" Background="Beige"&gt; &lt;Viewbox x:Name="viewBox" Stretch="UniformToFill"&gt; &lt;Canvas x:Name="designCanvas" Background="{Binding ElementName=mainControl, Path=Background, Mode=TwoWay}"&gt; &lt;/Canvas&gt; &lt;/Viewbox&gt; &lt;/ScrollViewer&gt; </code></pre> <p>Here is how I add the shapes:</p> <pre><code>Rectangle horGuide = new Rectangle() { Tag = "horGuide", Fill = new SolidColorBrush(Colors.Cyan), Height = 0.5, Width = designCanvas.canvActualWidth*16, }; int h = designCanvas.horOffset; int v = designCanvas.vertOffset; double d = e.GetPosition(sideRule).Y; designCanvas.Children.Add(horGuide); Canvas.SetTop(horGuide, ((d+v )/ designCanvas.zoomFactor)); Canvas.SetLeft(horGuide, 0 - h); </code></pre> <p>To Zoom in:</p> <pre><code> viewBox.Width *= 2; viewBox.Height *= 2; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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