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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:08:30+00:00 2026-06-16T00:08:30+00:00

I modified a toggle switch so I can use an icon ontop of it.

  • 0

I modified a toggle switch so I can use an icon ontop of it. Then I added a custom property which holds the image information and it’s rotation. The definition of my image looks somewhat like this:

<Image x:Name="SwitchKnobActive" Source="{Binding Path=(common:FilterSwitchImageHolder.ActiveImage), RelativeSource={RelativeSource TemplatedParent}}" Width="50" Visibility="{Binding IsOn, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=True}" RenderTransformOrigin="0.5, 0.5">
    <Image.RenderTransform>
        <TransformGroup>
            <TranslateTransform x:Name="KnobActiveTranslateTransform"/>
            <RotateTransform Angle="{Binding Path=(common:FilterSwitchImageHolder.Angle), RelativeSource={RelativeSource TemplatedParent}}" />
        </TransformGroup>
    </Image.RenderTransform>
</Image>

Now when I select the image I want to scale it by the factor of two, when I do this I loose the rotation. I tried setting the rotation again like above but it got ignored.. Is there a way how I can keep an existing transformation?


Edit:

The transformation on click XAML:

<VisualState x:Name="Pressed">
    <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="RenderTransform" Storyboard.TargetName="SwitchKnobActive">
            <DiscreteObjectKeyFrame KeyTime="0">
                <DiscreteObjectKeyFrame.Value >
                    <ScaleTransform ScaleX="2" ScaleY="2"></ScaleTransform>
                </DiscreteObjectKeyFrame.Value>
            </DiscreteObjectKeyFrame>
        </ObjectAnimationUsingKeyFrames>
    </Storyboard>
</VisualState>

FYI: All this code is within a control template of a toggle switch.

  • 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-16T00:08:31+00:00Added an answer on June 16, 2026 at 12:08 am

    How are you applying scale transform?

    Usual pattern for this would be to add dummy scale transform to the transform group and modify it later. This way all other transforms are not being replaced.

    <Image.RenderTransform>
        <TransformGroup>
            <ScaleTransform x:Name="myScaleTransform" ScaleX="1.0" ScaleY="1.0">
            <TranslateTransform x:Name="KnobActiveTranslateTransform"/>
            <RotateTransform Angle="{Binding Path=(common:FilterSwitchImageHolder.Angle), RelativeSource={RelativeSource TemplatedParent}}" />
        </TransformGroup>
    </Image.RenderTransform>
    

    You can later access it from xaml storyboard like this:

    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 
      Storyboard.TargetName="SwitchKnobActive"
      Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I modified a program which creates a Queue and then add or remove items
I modified the code published on smbrown.wordpress.com which can extract the top tracks using
I modified bootstrap.css using LESS so I can use Bootstrap only inside of a
I've modified my run.sh file and added JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n but when I start
I modified the Writing to a file example such that I can store some
modified question after answer to use onclick=$( '#co1' ).attr( 'checked', true ); this works
I modified the table UserProfile in the database with some extra columns and then
I'm creating a toggle button with this function: http://pastebin.com/gLkeB7pi Then I'm cloning this toggle
I modified GNU tee to cycletee Source Code (You can download the binary from
Consider the following html page, which can load in many large png files: <html>

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.