microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
708 stars 112 forks source link

XAML Behaviors

XAML Behaviors is an easy-to-use means of adding common and reusable interactivity to your Windows UWP applications with minimal code. It is available for managed applications only. Use of XAML Behaviors is governed by the MIT License

Build Status

Platform Status
Managed Build Managed

Getting Started

Where to get it

Resources

More Info

Code Example

For an example of using Behaviors in an application, here is a snippet of XAML:

<Button xmlns:Interactivity="using:Microsoft.Xaml.Interactivity">
    <Interactivity:Interaction.Behaviors>
        <Interactivity:EventTriggerBehavior EventName="Click">
            <Interactivity:ChangePropertyAction PropertyName="Background">
                <Interactivity:ChangePropertyAction.Value>
                    <SolidColorBrush Color="Red"/>
                </Interactivity:ChangePropertyAction.Value>
            </Interactivity:ChangePropertyAction>
        </Interactivity:EventTriggerBehavior>
    </Interactivity:Interaction.Behaviors>
</Button>

Using Behaviors SDK

The documentation explains how to install Visual Studio, add the XAML Behaviors NuGet package to your project, and get started using the API.

Building Behaviors from Source

What You Need

Clone the Repository

Build and Create Managed XAML Behaviors NuGet

For WinUI: