ModernWpf icon indicating copy to clipboard operation
ModernWpf copied to clipboard

NavigationView event not thrown

Open Pi57 opened this issue 4 years ago • 2 comments

Hi,

I'm fight with a NavigationView, maybe I forget something...

So I have create a NavigationView, but I'm not able to get something with ItemInvoked or SelectionChanged.

Code used :

<ui:NavigationView x:Name="NavView" Grid.Row="1"
                   Loaded="NavView_Loaded"
                   ItemInvoked="NavView_ItemInvoked"
                   SelectionChanged="NavView_SelectionChanged"
                   IsBackButtonVisible="Collapsed"
                   PaneDisplayMode="Left"
                   IsPaneOpen="False" 
                   OpenPaneLength="140"
                   IsTabStop="True">

    <ui:NavigationView.MenuItems>

        <ui:NavigationViewItem Tag="home"
                               Content="Accueil">

            <ui:NavigationViewItem.Icon >
                <ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE80F;"/>
            </ui:NavigationViewItem.Icon>

        </ui:NavigationViewItem>

        <ui:NavigationViewItemSeparator/>

        <ui:NavigationViewItem Tag="search" 
                               Content="Recherche">

            <ui:NavigationViewItem.Icon >
                <ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE721;" />
            </ui:NavigationViewItem.Icon>

        </ui:NavigationViewItem>

        <ui:NavigationViewItem Tag="create" 
                               Content="Créer">

            <ui:NavigationViewItem.Icon >
                <ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xED0E;" />
            </ui:NavigationViewItem.Icon>

        </ui:NavigationViewItem>

        <ScrollViewer Grid.Row=" 1">

            <ui:Frame x:Name="ContentFrame" 
                   Grid.Row="1"
                   Padding="12,0,12,24" 
                   IsTabStop="False"
                   NavigationFailed="ContentFrame_NavigationFailed">

            </ui:Frame>
        </ScrollViewer>

</ui:NavigationView>

Then I use this :

        private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            Debug.Print("NavView SelectionChanged");
        }

        private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            Debug.Print("NavView ItemInvoked");
        }

But the event is never thrown when I click on the different NavigationViewItem

Can you help me ?

Thanks

Pi57 avatar Mar 03 '21 22:03 Pi57

Same here, can't trigger ItemInvoked event nor SelectionChanged event without C# code manual trigs.

I set MouseLeftUp event on every NavViewItem to bypass this issue.

kamyaw010 avatar Mar 10 '21 08:03 kamyaw010

I can't seem to reproduce this issue; both events fire using the provided code. Could you please share a repro project?

Kinnara avatar Apr 06 '21 17:04 Kinnara