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

  • Home
  • SEARCH
  • 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 8025111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:03:44+00:00 2026-06-04T23:03:44+00:00

I have the property: double _X; public double X { get { this.Title =

  • 0

I have the property:

    double _X;
    public double X
    {
        get {
            this.Title = _X.ToString();
            return _X; 
        }
        set { 
            _X = value;
            this.Title = _X.ToString(); // !!!! this line does not execute when property changes from storyboard
            RaisePropertyChanged("X"); }
    }

and the control:

   <Button x:Name="button" Content="Button" HorizontalAlignment="Left" Height="99.2" Margin="37,14,0,0" VerticalAlignment="Top" Width="98.4" RenderTransformOrigin="0.5,0.5">
        <Button.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform X="{Binding X}" Y="{Binding Y}"/>
            </TransformGroup>
        </Button.RenderTransform>
    </Button>

the storyboard:

<Storyboard x:Key="Storyboard1" AutoReverse="True" FillBehavior="HoldEnd">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="button">
            <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="100">
                <EasingDoubleKeyFrame.EasingFunction>
                    <CircleEase EasingMode="EaseOut"/>
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>

</Storyboard>

when I animate the property why does the set method does not change if I am implementing the INotifyPropertyChanged interface? In other words why does the line this.Title = _X.ToString(); does not execute meanwhile animating the storyboard. How can I update the X property every time the storyboard animates?


Edit

I forgot to mention the reason why I need this functionality. I often have to animate a property that is not in xaml. for example lets say I want to animate the master volume, or perhaps the mouse position. I know I can create a thread then do the math and create my own animation. but why reinvent the wheel if wpf already has several easing functions and animations. it will be nice if I could create a storyboard using expresion blend then use that storyboard to animate a property in my code behind.


Edit2

According to @clemens I have worked this out (maybe I am doing something wrong):

I have the class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel;
using System.Windows;

namespace SomeNamespace
{
    public partial class MyUserControl : UserControl, INotifyPropertyChanged
    {


        public static readonly DependencyProperty SomeDoubleProperty =
    DependencyProperty.Register("SomeDouble", typeof(Double),
        typeof(MyUserControl), new PropertyMetadata(0.0));


        public double SomeDouble
        {
            get
            {
                return (double)GetValue(SomeDoubleProperty);

            }
            set
            {
                SetValue(SomeDoubleProperty, value);
                MessageBox.Show("this msg should appear meanwhile animating!");
                // code does not execute
                RaisePropertyChanged("SomeDouble");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }




    }
}

I have the view

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:test="clr-namespace:SomeNamespace"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
    <Window.Resources>
        <Storyboard x:Key="Storyboard1"  >
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="SomeDouble" Storyboard.TargetName="m">
                <EasingDoubleKeyFrame KeyTime="0:0:5.4" Value="100">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <CircleEase EasingMode="EaseOut"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>            
        </Storyboard>
    </Window.Resources>
    <Grid>
        <test:MyUserControl x:Name="m" SomeDouble="5"></test:MyUserControl>
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="311,50,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />

    </Grid>
</Window>

and the button code behind starts the storyboard…

the property does not change in the code behind meanwhile animating it…

  • 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-04T23:03:46+00:00Added an answer on June 4, 2026 at 11:03 pm

    If i understand you right, you’re going to animate the X property of a TranslateTransform, that is also bound to your X property (you didn’t mention the class in which it is defined).

    Even if you had declared the binding two-way, your approach won’t work. A dependency property such as TranslateTransform.X gets its value from a variety of providers like style setters, triggers, animations, value inheritance, default value from property metadata, local value, and a few more (where data bindings set the local value). These providers are applied in a certain order, i.e. with a certain precedence.

    In your scenario this means that the RenderTransform.X gets its local value from a data binding. When you start an animation, the effective property value comes from that animation as long as it is running or holding the value. Meanwhile the local value of the property does not change, meaning that there is no effect on the binding (even if it was two-way).

    If you want to animate your X property, you could make it a custom dependency property and animate it directly.

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

Sidebar

Related Questions

I have user control with property public double X { get { return Canvas.GetLeft(this)
hi i have property named. public bool ShowLabels{get; set;} and one toolbar menu button
I have the following case: public class GeoLocation { public double Longitude { get;
I have 2 classes like below. public class Quest { public int ID{ get;set;
I have a bizarre problem with a 'double' property in Core Data. I have
I have the following property: @property (nonatomic, assign) double lastSynced; and here's my custom
I have a property in my backing bean that returns html code: public String
I have a property of type uint on my entity. Something like: public class
I have a base class like this: public class Trajectory{ public int Count {
I have a Device interface: public interface IDevice { double Measure(); } Some classes

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.