This is the Uno Platform home for UWP XAML Behaviors
Перейти к файлу
Jérôme Laban 9795ec0cee
Merge pull request #30 from unoplatform/dev/jela/5x
ci: Adjust sign packages
2023-06-27 16:53:02 -04: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
key Add StrongName signing to managed assemblies 2015-11-16 15:57:21 -08:00
samples chore: Adjust banner 2023-06-27 15:11:08 -04:00
scripts ci: Adjust signing 2023-06-27 16:26:10 -04:00
src chore: Bump to uno 5 2023-06-27 12:08:38 -04: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 Fixing .exe commit issue. 2015-09-04 11:27:41 -07:00
.vsts-ci.yml ci: Adjust sign packages 2023-06-27 16:51:33 -04:00
LICENSE Initial commit 2015-07-20 11:03:14 -07:00
README.md chore: Bump to uno 5 2023-06-27 12:08:38 -04:00
gitversion.yml feat: Add support for Uno 5 2023-06-14 11:21:03 -04:00
nuget.config chore: Update banner to latest 2023-06-27 14:52:23 -04:00

README.md

Uno Platform port of Xaml Behaviors

This port allows for Uno-based apps to use behaviors on Windows, iOS, Android and WebAssembly.

The WinUI Uno.Microsoft.Xaml.Behaviors.WinUI.Managed and UWP Uno.Microsoft.Xaml.Behaviors.Uwp.Managed Nuget packages is available.

To install the WinUI behaviors in .NET class libraries, such as the ones found in Uno Platform 4.7, use the following:

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows10.0.19041.0'">
  <PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net6.0-windows10.0.19041.0'">
  <PackageReference Include="Uno.Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.3.0" />
</ItemGroup>

You may need to adjust net6.0-windows10.0.19041.0 to the TargetFramework value found in your project.

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 both native and managed applications. Use of XAML Behaviors is governed by the MIT License

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>
	<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]
  • 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

Build and Create Native XAML Behaviors NuGet

  • Open the "BehaviorsSDKNative.sln" solution in Visual Studio
  • Batch Build for x86, x64, and ARM in Release
  • Run msbuild /t:Pack src/BehaviorsSDKNative/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj
    • (Optional) Add /p:TimestampPackage=true to include the timestamp in the NuGet package version