mvvmlight icon indicating copy to clipboard operation
mvvmlight copied to clipboard

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

Open ghost opened this issue 3 years ago • 1 comments

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>

ghost avatar Dec 18 '20 03:12 ghost

@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

michael-hawker avatar Apr 23 '21 23:04 michael-hawker