This is the official home for UWP XAML Behaviors on GitHub.
Перейти к файлу
Sergio Pedri 912c92895a
Merge pull request #287 from michael-hawker/llama/fix-playsoundaction
Update PlaySoundAction to MediaPlayerElement for UWP and WinUI 3
2024-11-18 17:32:18 -08:00
.github/workflows Merge pull request #256 from Sergio0694/user/sergiopedri/modern-uwp-support 2024-11-13 15:02:58 -08:00
NuGet_Documentation Update README.Managed.md 2017-10-17 08:06:08 -07:00
assets/packaging Removing documentation assets from repo 2015-11-19 13:24:14 -08:00
azure-pipelines Update build.yml 2024-11-18 10:25:52 -08:00
key Fix issue with incorrect public key for unit test projects. 2020-02-24 12:34:22 -08:00
samples/CS Retire the C++ UWP API 2024-09-10 14:26:48 -04:00
scripts Bump SDK for UWP .NET 9 project to 19041 2024-11-18 14:30:15 -08:00
src/BehaviorsSDKManaged Update PlaySoundAction for UWP to use MediaPlayerElement, as per recommendations 2024-11-18 17:04:37 -08:00
tests Cleaned up file structure. 2015-07-23 11:17:48 -07:00
.gitattributes Pushing new version of the sample project. 2015-09-09 05:21:39 -07:00
.gitignore Retire the C++ UWP API 2024-09-10 14:26:48 -04:00
LICENSE Initial commit 2015-07-20 11:03:14 -07:00
README.md Update README.md 2024-11-18 13:45:15 -08:00
SECURITY.md Adding Microsoft SECURITY.MD (#231) 2022-09-26 08:41:44 -07:00

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: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

  • Ensure that nuget.exe is available in PATH
  • If you're using Visual Studio
    • Open the "BehaviorsSDKManaged.sln" solution in Visual Studio
    • Change Build Configuration to Release
    • Build solution with right click > Build, or by clicking F6
  • If you're building from CLI (Visual Studio Developer Command prompt):
    • Run msbuild /restore -t:build src\BehaviorsSDKManaged\BehaviorsSDKManaged.sln /p:Configuration=Release
  • Run msbuild /t:pack src\BehaviorsSDKManaged\Microsoft.Xaml.Interactivity.Design\Microsoft.Xaml.Interactivity.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 /p:Configuration=Release
    • (Optional) Add /p:TimestampPackage=true to include the timestamp in the NuGet package version