{"id":20515,"date":"2018-12-10T11:27:32","date_gmt":"2018-12-10T18:27:32","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/dotnet\/?p=20515"},"modified":"2019-02-28T00:23:49","modified_gmt":"2019-02-28T07:23:49","slug":"open-sourcing-xaml-behaviors-for-wpf","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/open-sourcing-xaml-behaviors-for-wpf\/","title":{"rendered":"Open Sourcing XAML Behaviors for WPF"},"content":{"rendered":"<p>Today, we are excited to announce that we are open sourcing <a href=\"https:\/\/github.com\/Microsoft\/XamlBehaviorsWpf\/wiki\">XAML Behaviors for WPF<\/a>.<\/p>\n<p>In the past, we <a href=\"https:\/\/blogs.windows.com\/buildingapps\/2015\/11\/30\/xaml-behaviors-open-source-and-on-uwp\/\">open sourced XAML Behaviors for UWP<\/a> which has been a great success and the <a href=\"https:\/\/www.nuget.org\/profiles\/xamlexperiencesteam\">Behaviors NuGet package<\/a> has been downloaded over 500k times. One of the top community asks has been to <a href=\"https:\/\/github.com\/Microsoft\/XamlBehaviors\/issues\/60\">support WPF<\/a> in the same way. XAML Behaviors for WPF now ships as a NuGet package &#8211; <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Xaml.Behaviors.Wpf\/\">Microsoft.Xaml.Behaviors.Wpf<\/a> . This will allow new features and bug fixes to be addressed faster. When a new Behavior or feature is added to the repo, it can be consumed and used almost immediately. Opening to contributions lets the Behaviors platform grow by empowering the community to set the pace and direction. While you can continue to use the Extension SDK, further development will only take place on GitHub and be published in the NuGet package under the new namespace Microsoft.Xaml.Behaviors.<\/p>\n<h2>Start using XAML Behaviors for WPF now!<\/h2>\n<p>You can install the latest version of WPF XAML Behaviors in both Visual Studio and Blend using the NuGet Package Manager:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-20545 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Pic1.png\" alt=\"\" width=\"1167\" height=\"661\" \/><\/p>\n<p>From the package manager console:<\/p>\n<pre class=\"lang:default decode:true\">PM &gt; Install-Package Microsoft.Xaml.Behaviors.Wpf<\/pre>\n<p>From Blend Assets pane:<\/p>\n<p><img decoding=\"async\" class=\"size-full wp-image-20555 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Pic2.png\" alt=\"\" width=\"499\" height=\"328\" \/><\/p>\n<p>Like UWP, we have made updates to Blend for Visual Studio 2019.Instead of presenting a pre=populated list of Behaviors in the Assets Pane, Blend prompts the user with a link to install the NuGet Package. Clicking this link will download and reference the latest NuGet Package and populate the list with the latest and greatest Behaviors. Note that if this is an existing project which references the old Behaviors SDK, the list will be pre-populated with the Behaviors from the SDK. See below for steps to migrate to the NuGet package.<\/p>\n<h2>Migrating .NET Framework projects from Extension SDK to NuGet<\/h2>\n<p>The NuGet package ships with DLLs under the &#8220;Microsoft.Xaml.Behaviors&#8221; namespace. \u00a0Since the APIs for WPF are the same as the original Extension SDK, switching over is as easy as installing the NuGet package and updating the xmlns and the usings. Note that Behaviors are not yet fully supported on .NET Core.<\/p>\n<h3>Steps to migrate:<\/h3>\n<ol>\n<li>Remove reference to \u201cMicrosoft.Expression.Interactions\u201d and \u201cSystem.Windows.Interactivity\u201d<\/li>\n<li>Install the \u201cMicrosoft.Xaml.Behaviors.Wpf\u201d NuGet package.<\/li>\n<li>XAML files &#8211; replace the xmlns namespaces &#8220;<a href=\"http:\/\/schemas.microsoft.com\/expression\/2010\/interactivity\">http:\/\/schemas.microsoft.com\/expression\/2010\/interactivity<\/a>&#8221; and &#8220;<a href=\"http:\/\/schemas.microsoft.com\/expression\/2010\/interactions\">http:\/\/schemas.microsoft.com\/expression\/2010\/interactions<\/a>&#8220;with &#8220;<a href=\"http:\/\/schemas.microsoft.com\/xaml\/behaviors\">http:\/\/schemas.microsoft.com\/xaml\/behaviors<\/a>&#8220;<\/li>\n<li>C# files &#8211; replace the usings in c# files &#8220;Microsoft.Xaml.Interactivity&#8221; and &#8220;Microsoft.Xaml.Interactions&#8221; with &#8220;Microsoft.Xaml.Behaviors&#8221;<\/li>\n<\/ol>\n<p><img decoding=\"async\" class=\"size-full wp-image-20565 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Pic3.gif\" alt=\"\" width=\"1153\" height=\"651\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>A big thank you to our <a href=\"https:\/\/github.com\/Microsoft\/XamlBehaviorsWpf\/wiki\/About-the-Team\">MVP leaders<\/a> for dedicating their time and effort in helping guide this project as WPF XAML Behaviors are opened to the community.<\/p>\n<p>Contributions of new and useful Behaviors are welcomed and encouraged. Have feedback, suggestions, or comments? We would love to hear them \u2013 please submit an issue on the <a href=\"https:\/\/github.com\/Microsoft\/XamlBehaviorsWpf\/issues\">GitHub page<\/a> or <a href=\"mailto:da2ddb9c.microsoft.com@amer.teams.ms\">email<\/a> us.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today, we are excited to announce that we are open sourcing XAML Behaviors for WPF. In the past, we open sourced XAML Behaviors for UWP which has been a great success and the Behaviors NuGet package has been downloaded over 500k times. One of the top community asks has been to support WPF in the [&hellip;]<\/p>\n","protected":false},"author":969,"featured_media":21773,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[509,489],"tags":[107,158,164],"class_list":["post-20515","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wpf","category-xaml","tag-open-source","tag-wpf","tag-xaml"],"acf":[],"blog_post_summary":"<p>Today, we are excited to announce that we are open sourcing XAML Behaviors for WPF. In the past, we open sourced XAML Behaviors for UWP which has been a great success and the Behaviors NuGet package has been downloaded over 500k times. One of the top community asks has been to support WPF in the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/20515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/969"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=20515"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/20515\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/21773"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=20515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=20515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=20515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}