Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
X

XamlFlair

> 数据库
Open source

XamlFlair is an animation library for UWP, WPF, and Uno, built to facilitate Xaml animations using only attached properties.

846 stars0 likes1 views
WebsiteGitHub

About

XamlFlair is an animation library for UWP, WPF, and Uno, built to facilitate Xaml animations using only attached properties.

XamlFlair

The goal of the XamlFlair library is to ease the implementation of common animations and allow a developer to easily add a single or combined set of animations with just a few lines of Xaml.

Showcase

Sekuence Puzzle Game
      |

Supporting Me

If you would like to support my work with a few coffees, you can do it here: Buy Me A Coffee. Your help allows me to continue to spend time on this project and continue to maintain and update it with new features when possible. Thanks in advance!

Contents

  • Install from Nuget

  • Features Overview

  • Basic Concepts

  • Usage

  • Base Animation Types

  • Color Animations (WPF And Uno Only)

  • Overriding the Global Default Values

  • Using a ResourceDictionary for Base Settings

  • Default Animations (WPF Only)

  • TransformOn Property (WPF Only)

  • Perspective Rotations (UWP Only)

  • Combining Animations

  • Overriding Values

  • Relative Translations on X and Y Axes

  • Compound Animations

  • Repeating Animations

  • Events

  • Bindings

  • Primary and Secondary Completion Commands

  • Using the StartWith Property

  • Using the AllowOpacityReset Property (WPF Only)

  • Using the ClipToBounds Property (UWP And Uno Only)

  • Debugging Animations

  • Logging Animations

  • ListViewBase (UWP and Uno) and ListBox-based (WPF) Animations

Install from Nuget

Platform Package NuGet
UWP [XamlFlair.UWP][UWPNuGet] [![UWPNuGetShield]][UWPNuGet]
WPF [XamlFlair.WPF][WPFNuGet] [![WPFNuGetShield]][WPFNuGet]
Uno [XamlFlair.Uno][UNONuGet] [![UNONuGetShield]][UNONuGet]

To install XamlFlair, run the following command in the Package Manager Console:

UWP:

Install-Package XamlFlair.UWP

Your app must target a minimum of Windows 10 version 1809 (build 17763)

WPF:

Install-Package XamlFlair.WPF

Uno:

Install-Package XamlFlair.Uno

Your UWP app must target a minimum of Windows 10 version 1809 (build 18362)

Features Overview

Feature UWP WPF UWP (Uno) iOS (Uno) Android (Uno) Wasm (Uno) EXPERIMENTAL
Animation System Composition Storyboards Storyboards Storyboards Storyboards Storyboards
Transform Type N/A TransformGroup CompositeTransform CompositeTransform CompositeTransform CompositeTransform
DefaultAnimations.xaml - ✔ - - - -
TransformOn - ✔ - - - -
Compound Animations ✔ ✔ ✔ ✔ ✔ ✔
Relative Translations ✔ ✔ ✔ ✔ ✔ ✔
Repeating Animations ✔ ✔ ✔ ✔ ✔ ✔
Events & Bindings ✔ ✔ ✔ ✔ ✔ ✔
Primary/Secondary Completion Commands ✔ ✔ ✔ ✔ ✔ ✔
StartWith ✔ ✔ ✔ ✔ ✔ ✔
AllowOpacityReset - ✔ - - - -
ClipToBounds ✔ N/A ✔ ✔ ✔ ✔
Animated Lists ✔ ✔ ✔ ✔ ✔ ✔
Blur Effect ✔ ✔ - - - -
Saturation Effect ✔ - - - - -
Tint Effect ✔ - - - - -
Color Animations - ✔ ✔ ✔ ✔ ✔
Perspective Rotations (Swivel) ✔ - - - - -
Debugging Animations ✔ ✔ ✔ ✔ ✔ -

Basic Concepts

The basic concept of XamlFlair is based on animations that are categorized as From and To. Any UI element that consists of a From animation will start with one or more arbitrary values, and complete using the default value of the corresponding property. Any UI element that consists of a To animation will start in its current state and animate to one or more arbitrary values.

Example of a From animation (a UI element translating to the default value of a Translation (0)):

Example of a To animation (a UI element sliding away from its current state):

Note: It's important to note there is an exception to this rule for Color Animations, which is explained in the Base Animation Types section.

Usage

To begin, you need to have the following Xaml namespace reference:

UWP and Uno:

xml
xmlns:xf="using:XamlFlair"

WPF:

xml
xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"

From here on, it's a simple matter of setting an attached property to any FrameworkElement that needs an animation:

xml

Note: If your FrameworkElement defines a CompositeTransform in your Xaml, it will be altered during the animation process.

Note: The use of StaticResource is to reference global common animations, which is discussed in the next section.

Base Animation Types

Fade

Warning: Be careful when animating FadeTo since the element remains in the Visual Tree if the Visibility is Visible. There may be cases where you'll need to manually manage IsHitTestVisible to allow the user to tap through the element.

Translate

Scale

Rotate

Blur (UWP and WPF only)

Saturate (UWP only)

Tint (UWP only)

Color (WPF and Uno only)

Note: It's important to note when animating a color using a From animation, the color will animate from a specified value to its current state instead of a default value.

Swivel (UWP only)

Note: Read the section Perspective Rotations (UWP Only) for further details.

The following lists some notable default values when working with XamlFlair:

  • Kind: FadeTo
  • Duration (milliseconds): 500
  • Easing: Cubic
  • Easing Mode: EaseOut
  • TransformCenterPoint: (0.5, 0.5)
  • Event: Loaded
  • InterElementDelay (milliseconds): 25 (List controls only)
  • TransformOn: Render (WPF only)
  • Saturation: 0.5 (UWP only)
  • Tint: Transparent (UWP only)

Color Animations (WPF And Uno Only)

Color animations require some attention since they are slightly different than the other base type animations. When using either ColorTo and ColorFrom, the following must be done:

  • You can only animate the following properties: Control.Background, Control.Foreground, Control.BorderBrush, Border.Background, Border.BorderBrush, TextBlock.Foreground, Shape.Fill, Shape.Stroke
  • Make sure to set a brush on the corresponding property you intend to animate
  • You must also specify the target property using ColorOn

The following example will animate the Rectangle's Fill from RoyalBlue to DarkGreen:

xml

Overriding the Global Default Values

If you have the need to globally change one of the default animation values (for example, having a default Duration of 750 instead of 500), you can call the OverrideDefaultSettings function in your app's initialization code. The following example changes the default values for Duration and Easing:

cs
XamlFlair.Animations.OverrideDefaultSettings(
    duration: 750,
    easing: EasingType.Quadratic);

Therefore, with the sample code above, every animation will run for 750ms with a quadratic easing.

Using a ResourceDictionary for Base Settings

All common animations should be placed in a global ResourceDictionary (ex: Animations.xaml) and used where needed throughout the app. The goal is to consolidate all the animations into one file with meaningful names so that any developer can understand exactly what animation is applied to a FrameworkElement. Here's a small example of what it looks like:

xml

    50
    -50
    0.75
    1.25

    

    

    
    

    
    
    .
    .
    .
    

To setup this set of pre-configured AnimationSettings already available in your app, perform the following steps:

  1. Right-click on your project, then click Add > New Item...
  2. Choose Resource Dictionary and name it Animations.xaml
  3. In your App.xaml, add the following:
xml
    
        
            
                
            
        
    
  1. In Animations.xaml, copy & paste the contents from the corresponding links below:
  • Animation settings for UWP

  • Animation settings for WPF

  • Animation settings for Uno

Your app now has a global set of common animations ready to use.

Default Animations (WPF Only)

Alternatively to creating your own ResourceDictionary containing your custom AnimationSettings, XamlFlair provides some Default Animations.

To reference these Default Animations in your application, perform the following steps in your App.xaml:

  1. Define the XamlFlair.WPF namespace at the top:
xml
    xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"
  1. Update your Application Resources:
xml
    
        
            
                
            
        
    

Your application now has a global set of Default animations ready to use.

If Visual Studio Intellisense does not work when using

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#animationunouno-platformuwp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库