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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:40:58+00:00 2026-06-08T05:40:58+00:00

I’ve been working a bit with an image editor in Silverlight for the past

  • 0

I’ve been working a bit with an image editor in Silverlight for the past week or so. It’s my first encounter with it and I still haven’t fully gotten my head around data bindings and datacontext or mvvm. I have a rotation method and I want to be able to pass the angle value from a text box on my MainPage.xaml to the method.I have an initial value set of 90 and my function rotates the image 90 degrees when I click it. The textbox is empty at runtime and also is clearly not updating my rotation angle.

MainPage.xaml

<Grid DataContext="{Binding Path=Project}" Height="70" Name="grid1" Width="200">
   <Grid.RowDefinitions>
      <RowDefinition Height="35" />
      <RowDefinition Height="35" />
   </Grid.RowDefinitions>
   <Grid.ColumnDefinitions>
      <ColumnDefinition Width="84*" />
      <ColumnDefinition Width="57*" />
      <ColumnDefinition Width="59*" /> 
   </Grid.ColumnDefinitions>

<Button Command="{Binding Path=RotateCWElementCommand}"
      Height="30" Name="btnRotCW" Width="30" Grid.Column="2" Margin="15,0,14,5" Grid.Row="1">
<Image Source="../Assets/Images/Icons/object-rotate-right.png" Grid.Column="1"
      Grid.Row="4" Height="20" HorizontalAlignment="Left" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="20" />
</Button>

<TextBlock FontWeight="Bold" HorizontalAlignment="Left" Margin="10,10,0,8" Text="Rotate" VerticalAlignment="Center" />
<TextBlock FontWeight="Bold" HorizontalAlignment="Left" Margin="34,9,0,10" Text="Angle:" VerticalAlignment="Center" Grid.Row="1" />
<TextBox Text="{Binding Path=RotateElement.Angle, Mode=TwoWay}" Height="24" Name="textBox1" Width="52" Grid.Column="1" Margin="0,6,5,5" Grid.Row="1" />
</Grid>

(Relevant code from)
Project.cs-

namespace ImageEditor.Client.BLL
{
public class Project : INotifyPropertyChanged
{

            #region Properties
            private RotateTransform rotateElement;
      public RotateTransform RotateElement
      {
        get { return rotateElement; }
        set
        {
            rotateElement = value;
            NotifyPropertyChanged("RotateElement");

        }
    }

        #endregion
    #region Methods


    private void RotateCWElement(object param)
    {
        FrameworkElement element = this.SelectedElement;
        RotateTransform RotateElement = new RotateTransform();

        RotateElement.Angle = 90;
        RotateElement.CenterX = element.ActualWidth * 0.5;
        RotateElement.CenterY = element.ActualHeight * 0.5;
        element.RenderTransform = RotateElement;


    }

What am I doing wrong here? Is it my datacontext or my binding path that is the problem? What should they be? Formatting is a little off sorry

  • 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-08T05:41:00+00:00Added an answer on June 8, 2026 at 5:41 am

    the UI does not know that a property in your object has changed, since you only notify when your object changes, but not the properties in it:

     private void RotateCWElement(object param) 
     { 
            FrameworkElement element = this.SelectedElement; 
            if (this.RotateElement == null) this.RotateElement = new RotateTransform(); 
    
            RotateElement.Angle = 90; 
            RotateElement.CenterX = element.ActualWidth * 0.5; 
            RotateElement.CenterY = element.ActualHeight * 0.5; 
            element.RenderTransform = RotateElement; 
    
            //tell the UI that this property has changed
            NotifyPropertyChanged("RotateElement"); 
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites 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.