Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4048544
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:49:49+00:00 2026-05-20T13:49:49+00:00

I am currently designing a layout app in Silverlight and have a Canvas inside

  • 0

I am currently designing a layout app in Silverlight and have a Canvas inside of a Viewbox. 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.

The problem comes when I try to zoom at a factor of 4 or greater or at 0.5 (zoomed out).

Update: The horizontal lines are still there, they are just not drawing. Interaction between the the other shapes and the disappearing ones is still present

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.

What is happening?

Update
Very Simple XAML:

<ScrollViewer x:Name="scrollViewer" 
              Padding="0"
              ScrollViewer.VerticalScrollBarVisibility="Auto"
              ScrollViewer.HorizontalScrollBarVisibility="Auto"
              IsTabStop="False"
              Background="Beige">
    <Viewbox x:Name="viewBox" Stretch="UniformToFill">
        <Canvas x:Name="designCanvas"  
                Background="{Binding ElementName=mainControl, Path=Background, Mode=TwoWay}">
        </Canvas>
    </Viewbox>
</ScrollViewer>

Here is how I add the shapes:

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);

To Zoom in:

       viewBox.Width *= 2;
       viewBox.Height *= 2;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:49:50+00:00Added an answer on May 20, 2026 at 1:49 pm

    Why not use the ScaleTransform class to zoom in and out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am designing a new website and I want to plan it properly.
I'm designing my personal website at the moment and want to have images inside
I'm currently designing an app and all the content is nearly finished. However, I
I am currently designing and planning an app that I intend to release for
I'm currently designing a program that will involve some physics (nothing too fancy, a
I'm currently designing a brand new database. In school, we always learned to put
We are currently designing a website that will be accessed from kiosks in a
I'm currently designing a database for a project. Now I'm debating with myself whether
Currently I am designing a website and I am finding it VERY difficult to
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.