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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:29:05+00:00 2026-05-25T19:29:05+00:00

I want to rotate Image Control using LayoutTransform but the problem i am facing

  • 0

I want to rotate Image Control using LayoutTransform but the problem i am facing is that i can do this in XMAL but not code behind.

i am new to WPF

here is XMAL
`

 <Image Grid.Column="1" Grid.Row="4" Height="155" HorizontalAlignment="Left"    
  Margin="103,0,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="139"  
  Source="/7SegmentLed;component/Images/Caster1.png" Grid.RowSpan="2" >
     <Image.LayoutTransform>
       <RotateTransform Angle="{Binding AngleSlider}" />
     </Image.LayoutTransform>
  </Image>

and CODE

double AngleSlider = 90.0;

image1.DataContext = AngleSlider;

i want to update it dynamically from the values i compute at back but the fact is that i donot want to change the image it is fixed and will not change

it would be great if anyone let me know what i am doing wrong

  • 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-25T19:29:06+00:00Added an answer on May 25, 2026 at 7:29 pm

    Your binding is a bit off; while you can set the DataContext to a double, your binding is going to attempt to find a property called AngleSlider on your double, which is obviously not there.

    So instead, create a class with a property of type Double called AngleSlider like so:

    public class MySliderDataContext : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
    
        public double AngleSlider 
        { 
           get { return _angle; }
           set 
           { 
               _angle = value;
               if(PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs("AngleSlider"));
           }
         }           
    }
    

    Create an instance of this class, and save it in a field on your Window, and then assign that instance to the DataContext:

    private MySliderDataContext _sliderAngle;
    
    image1.DataContext = _sliderAngle;
    

    Now, when necessary you can do:

    _sliderAngle.SliderAngle = 90;
    

    And your image should rotate.

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

Sidebar

Related Questions

I want to rotate a image with UIslider control. I have done that with
I want to rotate an image using ImageView.setImageMatrix(matrix) but it simply doesn't have any
I want to rotate the image around its center point.The problem i am facing
My problem is that I want to rotate the UIImageView of a UIButton .
When I use this code to rotate the image, the destination image size remains
I'm using the following code to rotate an image by an angle taking the
I want to rotate an image continuously on page load. Code works fine for
How can I rotate the hue of an image using GDI+'s ImageAttributes (and presumably
hai i want to rotate an image back and forth. But now it is
I want to rotate the below image on a center point using one finger

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.