How to run a certain Microsoft animation example

Nicholas Piazza 546 Reputation points
2022-03-31T13:22:20.647+00:00

In the Microsoft document System.Windows.Media.Examination, the BeginAnimation topic (https://learn.microsoft.com/en-us/dotnet/api/system.windows.media.animation.animatable.beginanimation?view=windowsdesktop-6.0) has an example. However, the example by itself does not seem to be runnable. I've created a WPF application using VS 2022 and inserted that code into the MainWindow.xaml.cs file, but I don't know how to run the example. The animation class is derived from Page, but I've even moved the example code into the MainWindow class and tried to activate the example from InitializeComponent(), but when I run it only a blank Window is displayed, and when I put a breakpoint in InitializeComponent, I find it's not even being called.

What code/XAML do I need to run this example?

Developer technologies | Windows Presentation Foundation
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Castorix31 91,501 Reputation points
    2022-03-31T13:57:44.99+00:00

    You can just put the Page class in the XAML
    (inside <Window> </Window>) :

      <local:InteractiveAnimationExample Background="Magenta">  
            
      </local:InteractiveAnimationExample>  
    

    188784-interactiveanimationexample.gif

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.