This is the official home for UWP XAML Behaviors on GitHub.
Перейти к файлу
Sergio Pedri 60b211fb40 Set 'ContinuousIntegrationBuild' in more steps 2024-09-18 11:25:59 +02:00
.github/workflows
NuGet_Documentation
assets/packaging
azure-pipelines Set 'ContinuousIntegrationBuild' in more steps 2024-09-18 11:25:59 +02:00
key
samples/CS
scripts
src/BehaviorsSDKManaged Set 'EmbedUntrackedSources' to true 2024-09-17 21:22:26 +02:00
tests
.gitattributes
.gitignore
LICENSE
README.md
SECURITY.md

README.md

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:Core="using:Microsoft.Xaml.Interactions.Core" xmlns:Interactivity="using:Microsoft.Xaml.Interactivity">
    <Interactivity:Interaction.Behaviors>
        <Core:EventTriggerBehavior EventName="Click">
            <Core:ChangePropertyAction PropertyName="Background">
                <Core:ChangePropertyAction.Value>
                    <SolidColorBrush Color="Red"/>
                </Core:ChangePropertyAction.Value>
            </Core:ChangePropertyAction>
        </Core: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

  • Open the "BehaviorsSDKManaged.sln" solution in Visual Studio
  • Change Build Configuration to Release
  • Build [Ctrl + B]
  • Ensure that nuget.exe is available in PATH
  • Run msbuild /t:pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactions.Design\Microsoft.Xaml.Interactions.Design.csproj
    • (Optional) Add /p:TimestampPackage=true to include the timestamp in the NuGet package version

For WinUI:

  • Run msbuild /t:Pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.WinUI\Microsoft.Xaml.Interactivity.WinUI.csproj
    • (Optional) Add /p:TimestampPackage=true to include the timestamp in the NuGet package version