Reputation: 1025
I'm experimenting with using Interaction.Behaviors in XAML to bind events to my controller like so,
<GridView x:Name="mygrid" >
<interact:Interaction.Behaviors>
<interactcore:EventTriggerBehavior EventName="SelectionChanged">
<interactcore:InvokeCommandAction
Command="{Binding Controller.Test}"
CommandParameter="{Binding ElementName=mygrid, Path=SelectedItem}"/>
</interactcore:EventTriggerBehavior>
</interact:Interaction.Behaviors>
</GridView>
This works perfectly except... Visual Studio 2015 shows the following errors,
Severity Code Description Project File Line Suppression State
Error The name "EventTriggerBehavior" does not exist in the namespace "using:Microsoft.Xaml.Interactions.Core". MVC C:\Prototype\MVC\MVC\MainPage.xaml 19
Error The name "InvokeCommandAction" does not exist in the namespace "using:Microsoft.Xaml.Interactions.Core". MVC C:\Prototype\MVC\MVC\MainPage.xaml 20
Error The name "Interaction" does not exist in the namespace "using:Microsoft.Xaml.Interactivity". MVC C:\Prototype\MVC\MVC\MainPage.xaml 18
This has caused the designer to break, so even though the code works, the designer doesn't. Any ideas?
My includes are...
xmlns:interact="using:Microsoft.Xaml.Interactivity"
xmlns:interactcore="using:Microsoft.Xaml.Interactions.Core"
And just to clarify, I included the behaviors SDK via the "Add Reference..." dialog.
Upvotes: 6
Views: 7068
Reputation: 416
The answer that worked for me were the comments made by Grace Feng in the question and confirmed by Nick.
That is when doing Windows 10 Universal apps use the Microsoft.Xaml.Behaviors.Uwp.Managed nuget package and remove the Behaviors SDK (XAML) package
Upvotes: 7