d45b886906 | ||
---|---|---|
.github | ||
build | ||
samples | ||
src | ||
tests | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.nuke | ||
AvaloniaBehaviors.sln | ||
LICENSE.TXT | ||
NuGet.Config | ||
README.md | ||
_config.yml | ||
build.ps1 | ||
build.sh | ||
global.json |
README.md
Avalonia XAML Behaviors
AvaloniaBehaviors is a port of Windows UWP version of XAML Behaviors for Avalonia XAML.
Avalonia XAML Behaviors is an easy-to-use means of adding common and reusable interactivity to your Avalonia applications with minimal code. Avalonia port is available only for managed applications. Use of XAML Behaviors is governed by the MIT License.
Example Usage
Example of using Behaviors in an Avalonia
XAML application:
<Window xmlns="https://github.com/avaloniaui"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
Width="500" Height="400">
<Grid RowDefinitions="Auto,100">
<TextBox Name="textBox" Text="Hello" Grid.Row="0" Margin="5"/>
<Button Name="changePropertyButton" Content="Change Property" Grid.Row="1" Margin="5,0,5,5">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Click" SourceObject="{Binding #changePropertyButton}">
<ia:ChangePropertyAction TargetObject="{Binding #textBox}" PropertyName="Text" Value="World"/>
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</Button>
</Grid>
</Window>
More examples can be found in sample application.
Building Avalonia XAML Behaviors
First, clone the repository or download the latest zip.
git clone https://github.com/wieslawsoltes/AvaloniaBehaviors.git
git submodule update --init --recursive
Build using IDE
- Visual Studio Community 2017 for
Windows
builds. - MonoDevelop for
Linux
builds.
Open AvaloniaBehaviors.sln
in selected IDE and run Build
command.
Build on Windows using script
Open up a command-prompt and execute the commands:
.\build.ps1
Build on Linux using script
Open up a terminal prompt and execute the commands:
./build.sh
Build on OSX using script
Open up a terminal prompt and execute the commands:
./build.sh
NuGet
Avalonia XamlBehaviors is delivered as a NuGet package.
You can find the packages here NuGet and install the package like this:
Install-Package Avalonia.Xaml.Behaviors
or by using nightly build feed:
- Add
https://www.myget.org/F/xamlbehaviors-nightly/api/v2
to your package sources - Update your package using
XamlBehaviors
feed
and install the package like this:
Install-Package Avalonia.Xaml.Behaviors -Pre
NuGet Packages
- Avalonia.Xaml.Interactivity - Core library.
- Avalonia.Xaml.Interactions - Default actions and behaviors.
- Avalonia.Xaml.Interactions.Custom - Custom actions and behaviors.
- Avalonia.Xaml.Behaviors - Meta package containing core library and default actions and behaviors
Package Dependencies
- Avalonia
- System.Reactive
- System.Reactive.Core
- System.Reactive.Interfaces
- System.Reactive.Linq
- System.Reactive.PlatformServices
- Serilog
- Splat
- Sprache
Package Sources
Resources
License
Avalonia XAML Behaviors is licensed under the MIT license.