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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:19:27+00:00 2026-06-04T13:19:27+00:00

I often have to animate several things that do not belong to the view

  • 0

I often have to animate several things that do not belong to the view in wpf such as the volume of my computer or the position of the mouse. I will like to do so by using wpf storyboards and built in easing functions.

For example let’s say I want to use the following storyboard to animate (decrease volume) on my computer:

<Storyboard x:Key="Storyboard1">
        <DoubleAnimationUsingKeyFrames 
                     Storyboard.TargetProperty="someProperty"  
                     Storyboard.TargetName="SomeTarget">
            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0">
                <EasingDoubleKeyFrame.EasingFunction>
                    <CircleEase EasingMode="EaseOut"/>
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
</Storyboard>

and in my code behind I set the volume with the function:

  MyVolumeController.SetVolume(0);

as a result I will like to create a function that will look like: (note the function is some sort of pseudo code)

 public void AnimateProperty(Storyboard sb, Action<double> onPropertyChange)
 {
      var property = //sb.targetProperty;

      property.OnValueChanged += (a,b)=>{

           onPropertyChange(b.newValue);

      }

      sb.begin();// start animating

 }

then I would be able to animate the volume by calling that method as:

  AnimateProperty(
           (Storyboard)this.FindResource("Storyboard1"), // storyboard
           (newVal)=>{MyVolumeController.SetVolume(newVal) // action
  );
  • 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-04T13:19:29+00:00Added an answer on June 4, 2026 at 1:19 pm

    If you want to animate a property and get notified about value changes while the animation is running, you will have to make that property a dependency property, and attach a PropertyChangedCallback by dependency property metadata.

    A typical declaration of such a dependency property would look like the code below (with double as property type here):

    public class MyControl : ...
    {
        public static readonly DependencyProperty SomethingProperty =
            DependencyProperty.Register(
                "Something", typeof(double), typeof(MyControl),
                new FrameworkPropertyMetadata(
                    (o, e) => ((MyControl)o).SomethingChanged((double)e.NewValue)));
    
        public double Something
        {
            get { return (double)GetValue(SomethingProperty); }
            set { SetValue(SomethingProperty, value); }
        }
    
        private void SomethingChanged(double newValue)
        {
            // process value changes here
        }
    
        ...
    }
    

    Now you can easily animate this property, either by a Storyboard, or much simpler by applying an Animation directly:

    DoubleAnimation animation = new DoubleAnimation
    {
        To = ...,
        Duration = ...,
    };
    
    myControl.BeginAnimation(SomethingProperty, animation);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Often times in applications I have a property that would normally .animate(), but every
I often have comment forms and lots of users post things such as !!!!!!!!!!!
I often have to deal with XML documents that contain namespaced elements, but doesn't
I have found that I often have to implement some sort of a scheduler
When I have a controller, e.g. article I often have a action_view() that handles
At the company that I work with, we often have to integrate with client’s
While debugging jQuery apps that use AJAX, I often have the need to see
I often have large arrays, or large amounts of dynamic data in PHP that
I often have classes that are mostly just wrappers around some STL container, like
I often have to edit script files, the interpreter for which treats files that

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.