2015-09-03 00:40:44 +03:00
# **XAML Behaviors**
2015-09-03 01:00:01 +03:00
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
2015-09-03 00:40:44 +03:00
2016-01-22 00:50:19 +03:00
#Build Status
| Platform | Status |
| -------- | ------ |
| Managed | < img src = "https://ci.appveyor.com/api/projects/status/0dptycdhhykyscr4/branch/master?svg=true" / > |
2016-01-23 02:43:24 +03:00
| Native | < img src = "https://ci.appveyor.com/api/projects/status/897ervx359xqa7vh/branch/master?svg=true" / > |
2016-01-22 00:50:19 +03:00
2015-09-03 00:40:44 +03:00
Getting Started
-------------------
**Where to get it**
2015-11-19 23:27:13 +03:00
- NuGet package for [Native ](https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Uwp.Native/ ) and [Managed ](https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Uwp.Managed/ )
2015-09-03 00:40:44 +03:00
- [Source Code ](https://github.com/Microsoft/XamlBehaviors )
**Resources**
- [Documentation ](https://github.com/Microsoft/XamlBehaviors/wiki )
- [Samples ](/samples )
2016-01-21 04:08:50 +03:00
- [![Join the chat at https://gitter.im/Microsoft/XamlBehaviors ](https://badges.gitter.im/Microsoft/XamlBehaviors.svg )](https://gitter.im/Microsoft/XamlBehaviors?utm_source=badge& utm_medium=badge& utm_campaign=pr-badge& utm_content=badge)
2015-09-03 00:40:44 +03:00
**More Info**
- [Report a bug or ask a question ](https://github.com/Microsoft/XamlBehaviors/issues )
2015-11-19 23:27:13 +03:00
- [Contribute ](https://github.com/Microsoft/XamlBehaviors/wiki/Contribute-to-XAML-Behaviors )
2015-09-03 00:40:44 +03:00
- [License ](http://opensource.org/licenses/MIT )
Code Example
------------
For an example of using Behaviors in an application, here is a snippet of XAML:
2015-09-03 00:43:40 +03:00
```xml
2015-09-03 01:00:01 +03:00
< 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 >
2015-09-03 00:43:40 +03:00
```
2015-09-03 00:40:44 +03:00
Using Behaviors SDK
-------------------
2015-11-19 23:27:13 +03:00
The [documentation ](https://github.com/Microsoft/XamlBehaviors/wiki ) explains how to install Visual Studio, add the XAML Behaviors NuGet package to your project, and get started using the API.
2015-09-03 00:40:44 +03:00
Building Behaviors from Source
------------------------------
**What You Need**
2015-11-20 00:15:22 +03:00
- [Visual Studio 2015 Update 1 w/ Universal Windows Tools ](https://www.visualstudio.com/features/windows-apps-games-vs )
2015-11-19 23:27:13 +03:00
**Clone the Repository**
-Go to 'View' -> 'Team Explorer' -> 'Local Git Repositories' -> 'Clone'
-Add the XAML Behaviors repository URL (https://github.com/Microsoft/XamlBehaviors) and hit 'Clone'
2015-09-03 01:00:01 +03:00
2015-11-19 23:27:13 +03:00
2015-09-03 01:00:01 +03:00
**Build and Create Managed XAML Behaviors NuGet**
2015-11-19 23:27:13 +03:00
- Open the "BehaviorsSDKManaged.sln" solution in Visual Studio
2015-09-03 01:00:01 +03:00
- Change Build Configuration to Release
2015-11-19 23:27:13 +03:00
- Build [Ctrl + B]
- Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd**
- Run **scripts/CreateManagedNuGet.cmd**
2015-09-03 01:00:01 +03:00
**Build and Create Native XAML Behaviors NuGet**
2015-11-19 23:27:13 +03:00
- Open the "BehaviorsSDKNative.sln" solution in Visual Studio
- [Batch Build ](https://msdn.microsoft.com/en-us/library/169az28z(v=vs.90 ).aspx) for x86, x64, and ARM in Release
- Install the latest NuGet command-line tool by running **scripts/download-nuget.cmd**
2015-11-20 00:15:22 +03:00
- Run **scripts/CreateNativeNuGet.cmd**