XAML Behaviors for WPF is now open source

Original author: Karan Nandwani
  • Transfer
We are pleased to announce that just recently, WPF has become XAML Behaviors Open Source.

Last year, we opened the XAML Behaviors source code for UWP, which was a great success, and the NuGet Behaviors package was downloaded over 500,000 times. WPF's XAML Behaviors now ships as NuGet package - Microsoft.Xaml.Behaviors.Wpf . More under the cut!



This will allow you to quickly add new features and fix bugs. When a new Behavior or feature is added to the repository, they can be used almost immediately. Openness to corrections allows the Behaviors platform to evolve, giving the community the opportunity to set the pace and direction. Although you can continue to use the Extension SDK, further development will be done only on GitHub and will be published in the NuGet package in the new Microsoft.Xaml.Behaviors namespace.

Start using XAML Behaviors for WPF now.


You can install the latest version of WPF XAML Behaviors in both Visual Studio and Blend using the NuGet package manager:



From the package manager console:

PM > Install-Package Microsoft.Xaml.Behaviors.Wpf

From Blend Assets:



As in the case of UWP, we made updates for Blend for Visual Studio 2019. Instead of presenting a pre-populated Behaviors list in the Blend assets panel, the user is presented with a link to install the NuGet package. By clicking on this link, you can download the latest NuGet package. Please note that if this is an existing project that references the old SDK Behaviors, the list will be pre-populated with the Behaviors from the SDK. Below are instructions for migrating to the NuGet package.

Migrating .NET Framework projects from Extension SDK to NuGet


The NuGet package comes with a DLL in the Microsoft.Xaml.Behaviors namespace. Since the WPF APIs are the same as in the original Extension SDK, switching is as easy as installing NuGet and updating xmlns and usings. Note that the behavior is not yet fully supported in .NET Core.

Migration steps


  1. Remove the link to "Microsoft.Expression.Interactions" and "System.Windows.Interactivity"
  2. Install the NuGet Microsoft.Xaml.Behaviors.Wpf package.
  3. XAML files — replace the xmlns “http://schemas.microsoft.com/expression/2010/interactivity” and “http://schemas.microsoft.com/expression/2010/interactions” namespaces with “http: // schemas. microsoft.com/xaml/behaviors “
  4. C # files - replace the values ​​in the C # files "Microsoft.Xaml.Interactivity" and "Microsoft.Xaml.Interactions" with "Microsoft.Xaml.Behaviors"



Conclusion


Many thanks to our MVP leaders for devoting their time and effort to help with this project: WPF XAML Behaviors is open to the community.



The guys from the Microsoft Developer Community @msdevru, the Microsoft Developer community channel for developers and anyone interested in new technologies helped us prepare this article .

Also popular now: