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 7072081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:45:55+00:00 2026-05-28T05:45:55+00:00

In Expression Blend, when you scroll the mouse wheel, the on-screen elements are zoomed

  • 0

In Expression Blend, when you scroll the mouse wheel, the on-screen elements are zoomed in/out, focused on the position where the mouse is.

I’m trying to implement an identical zoom in my own project, however I’m having problems with it jumping around after zooming, moving the mouse and then zooming again.

So far I’m using a RenderTransform with a ScaleTransform, using the mouse co-ordinates as the centerX and centerY for the ScaleTransform.

Does anyone know how they’ve done it in Expression Blend?

This is what I’ve done so far:

    private void ScrollCanvasMouseWheel(object sender, MouseWheelEventArgs e)
    {
        double zoomAmnt = e.Delta > 0 ? 0.2 : -0.2;
        _scaleTransformAmount += zoomAmnt;

        if (_scaleTransformAmount < 0.5)
            _scaleTransformAmount = 0.5;

        Point position = e.GetPosition(ScrollCanvas);

        var scaleTransform = ScrollCanvas.RenderTransform as ScaleTransform;
        if (scaleTransform == null) throw new ArgumentNullException("scaleTransform");

        scaleTransform.ScaleX = _scaleTransformAmount;
        scaleTransform.ScaleY = _scaleTransformAmount;
        scaleTransform.CenterX = position.X;
        scaleTransform.CenterY = position.Y;
    }
  • 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-28T05:45:55+00:00Added an answer on May 28, 2026 at 5:45 am

    That kind of zoom is nice so i tried to implement it once, the maths of it are a bit weird, it took me about two days to figure something out that worked, this might be rather ugly code though (variables with _ are fields on the zoom control):

    Point cursorPos = e.GetPosition(this);
    Point newCenter = _scaleT.Inverse.Transform(_translateT.Inverse.Transform(cursorPos));
    Point oldCenter = new Point(_scaleT.CenterX, _scaleT.CenterY);
    Vector oldToNewCenter = newCenter - oldCenter;
    _scaleT.CenterX = newCenter.X;
    _scaleT.CenterY = newCenter.Y;
    _translateT.X += oldToNewCenter.X * (_scaleT.ScaleX - 1.0);
    _translateT.Y += oldToNewCenter.Y * (_scaleT.ScaleY - 1.0);
    
    _scalingAnimation.From = _scaleT.ScaleX;
    if (e.Delta > 0)
    {
        _scalingAnimation.To = _scaleT.ScaleX * ZoomScaleChangeFactor;
    }
    else
    {
        _scalingAnimation.To = _scaleT.ScaleX / ZoomScaleChangeFactor;
    }
    _scaleT.BeginAnimation(ScaleTransform.ScaleXProperty, _scalingAnimation);
    _scaleT.BeginAnimation(ScaleTransform.ScaleYProperty, _scalingAnimation);
    
    this.ReleaseMouseCapture();
    

    The order of the transforms is important of course:

    TransformGroup tGroup = new TransformGroup();
    tGroup.Children.Add(_scaleT);
    tGroup.Children.Add(_translateT);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to explore behaviors with expression blend. I have seen the mouse
Is there a way to change the mouse wheel behavour in Expression Blend? I
I've just started out fiddling with WPF in Expression Blend and now I'm trying
I am trying to achieve this using Expression Blend 3. I need that every
Are there any good Expression Blend books out there yet? The help file is
I have a problem with scrolling using mouse wheel in a scroll viewer. It
I'm using expression blend and can't figure out how to go about fading a
I am trying to learn to use Expression Blend to build SilverLight UI. I
Free Expression Blend 4 for Windows Phone, Silverlight and XNA in all their glory...
I'm using Expression Blend 3 I click on add live datasource, add new xml

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.