My app had a series of buttons hardcoded to be a navigation menu, but I wanted to upgrade this to something more data-driven.
<Button Content="MyPage">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="Namespace.MyPage"/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</Button>
But when I tried to put this behavior on a different XAML element (specifically a TextBlock as part of a data template) I got the following error.
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException' occurred in NavMockUp.Windows.exe but was not handled in user code
WinRT information: Cannot add instance of type 'Microsoft.Xaml.Interactions.Core.EventTriggerBehavior' to a collection of type 'Microsoft.Xaml.Interactivity.BehaviorCollection'
<TextBlock Text="Click for Page">
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:NavigateToPageAction TargetPage="Namespace.MyPage"/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</TextBlock>