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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:59:15+00:00 2026-06-10T09:59:15+00:00

I have an application where I am adding various instances to a Canvas dynamically

  • 0

I have an application where I am adding various instances to a Canvas dynamically and the underlying Canvas has a scaling LayoutTransform. This works great for visuals like rectangles, where they correctly maintain a fixed stroke width, but expand in shape width/height as the canvas is ‘zoomed’ with the LayoutTransform. For TextBlock instances, however, the layout transformation is actually scaling the rendering of the text, making the font effectively larger. What I’d like to have happen instead is for the upper left origin of the TextBlock to translate with the layout transformation, with the text remaining the same size.

Here is the XAML for the ItemsControl that creates the Canvas:

            <ItemsControl ItemsSource="{Binding Annotations}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Canvas />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemContainerStyle>
                    <Style>
                        <Setter Property="Canvas.Left" Value="{Binding StartX}"/>
                        <Setter Property="Canvas.Top" Value="{Binding StartY}"/>                            
                    </Style>
                </ItemsControl.ItemContainerStyle>
                <ItemsControl.LayoutTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="{Binding ZoomScale}" ScaleY="{Binding ZoomScale}" 
                                        CenterX="0.5" CenterY="0.5"/>
                    </TransformGroup>
                </ItemsControl.LayoutTransform>
            </ItemsControl>

Here are some of the data templates that render the Annotations from the bound collection:

    <DataTemplate DataType="{x:Type Annotations:RectangleAnnotation}">
        <Rectangle Width="{Binding Width}" Height="{Binding Height}" Stroke="Blue" IsHitTestVisible="False"/>
    </DataTemplate>

    <DataTemplate DataType="{x:Type Annotations:TextAnnotation}">
        <TextBlock Text="{Binding Text}" Foreground="Orange" IsHitTestVisible="False"/>
    </DataTemplate>

The Annotation instances themselves are simple INotifyPropertyChanged implementations with the relevant bound properties (StartX, StartY and Text for the TextAnnotation.)

I haven’t been able to find any easy way to prevent the layout scaling of the text. However, before I start hacking my way to a solution, I thought I’d check: does anybody know of a clean way to fix this?

  • 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-06-10T09:59:16+00:00Added an answer on June 10, 2026 at 9:59 am

    Every Transform has an Inverse property which undoes its effect. So, you can bind the TextBlock’s RenderTransform to the Inverse of the Transform which scales the Canvas, that should undo its effect on the text rendering.

    The upper left corner normally is the origin for scaling, so if all is default, the Text should move to the upper left corner as you specified. However, if you’re using combined transforms or a different zoom center on the canvas, you might have to play around with the parameters a bit, but it should be quite easy to e.g. write a converter which only takes the scale factors of a transform in order to create an inverse scale transform without shifting the zoom center.

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

Sidebar

Related Questions

I have an application designed for iPhone OS 2.0 and I am adding some
I have an application built for 1.5 and I am adding higher resolution drawables
I have a web application, and am tasked with adding secure sign-on to bolster
I'm developing a client-server application and have been tasked with adding support for running
I am creating an application. I have to implement a bookmark feature, and adding
I have application with needs to have access to some sensitive data(in this case
I have a Java application that has a fixed thread pool of fifteen, the
This has been driving me crazy for a few days now. I have an
We have various versions of our base application out in the field: Version 1.0
I have a Ruby on Rails application that has two active environments, Stage 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.