microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
697 stars 112 forks source link

'Microsoft.Xaml.Interactions.Core.EventTriggerBehavior' to a collection of type 'Microsoft.Xaml.Interactivity.BehaviorCollection'. #148

Closed touseefbsb closed 5 years ago

touseefbsb commented 5 years ago

This exception occurs only on Release Build and not on debug build. it is recognized as a xaml parse exception. the exception occurs on my ShellPage.xaml, which has my NavigationView ( from winui library )

Exception : 'Microsoft.Xaml.Interactions.Core.EventTriggerBehavior' to a collection of type 'Microsoft.Xaml.Interactivity.BehaviorCollection'.

Code : I have following code bits which might be related to this exception.

loaded and unloaded events for my ShellPage.

<i:Interaction.Behaviors>
        <ic:EventTriggerBehavior EventName="Loaded">
            <ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
        </ic:EventTriggerBehavior>
        <ic:EventTriggerBehavior EventName="UnLoaded">
            <ic:InvokeCommandAction Command="{x:Bind ViewModel.UnLoadedCommand}" />
        </ic:EventTriggerBehavior>
</i:Interaction.Behaviors>

Loaded event for a button in NavigationView.Footer

<i:Interaction.Behaviors>
     <ic:EventTriggerBehavior EventName="Loaded">
            <ic:InvokeCommandAction Command="{x:Bind ViewModel.DisplayModeLoadedCommand}" />
     </ic:EventTriggerBehavior>
</i:Interaction.Behaviors>

2 events on NavigationView control itself, for item invoked and displaymodechanged.

<i:Interaction.Behaviors>
                <ic:EventTriggerBehavior EventName="ItemInvoked">
                    <ic:InvokeCommandAction Command="{x:Bind ViewModel.ItemInvokedCommand}" />
                </ic:EventTriggerBehavior>
                <ic:EventTriggerBehavior EventName="DisplayModeChanged">
                    <ic:InvokeCommandAction Command="{x:Bind ViewModel.DisplayModeChangedCommand}" />
                </ic:EventTriggerBehavior>
</i:Interaction.Behaviors>

Visual Studio Version VS 2017 15.9.4

uwp app min and max target : 17734 ( 1809 october 2018 update )

Microsoft.NETCore.UniversalWindowsPlatform : 6.1.9

Microsoft.Xaml.Behaviors.Uwp.Managed : 2.0.0

pedrolamas commented 5 years ago

This is expected and it's the same as #142. You need to manually add an exception on the rd.xml for the event you require.