lbugnion / mvvmlight

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Windows 10 UWP, Windows Presentation Foundation (WPF), Silverlight, Windows Phone.
http://www.mvvmlight.net
MIT License
1.17k stars 312 forks source link

MvvmLight with Microsoft.Xaml.Behaviours - Unable to use behaviour assets #96

Open ghost opened 3 years ago

ghost commented 3 years ago

Is not possible to use the Nuget package Microsoft.Xaml.Behaviours with MvvmLight library.

As I can see there's an incompatibility between System.Windows.Interactivity and Microsoft.Xaml.Behaviours because the share the same namespace.

As result if you add both packages to a project (net 4.7) and open blend is not possible to normally use behaviours from behaviour asset list.

Any idea to fix it?

Thank you Lox

UPDATE Even if Blend is not capable to manage wpf behaviours from asset list, is still possible to do it by hand adding the xmlns:b="http://schemas.microsoft.com/xaml/behaviors" directive in the head of the xaml and then using them like this:

<b:Interaction.Triggers>
    <b:DataTrigger Value="True" Binding="{Binding IsBusy}">
        <b:GoToStateAction StateName="Busy" TargetObject="{Binding ElementName=MainGrid}" />
    </b:DataTrigger>
</b:Interaction.Triggers>
michael-hawker commented 3 years ago

@LMFLox if you migrate to the new MVVM Toolkit from MVVM Light, you shouldn't have any troubles mixing it and the XAML Behaviors package: https://docs.microsoft.com/en-us/windows/communitytoolkit/mvvm/migratingfrommvvmlight