Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationViewItem with Command #220

Open
FlorentVllasa opened this issue Jun 23, 2021 · 2 comments
Open

NavigationViewItem with Command #220

FlorentVllasa opened this issue Jun 23, 2021 · 2 comments

Comments

@FlorentVllasa
Copy link

FlorentVllasa commented Jun 23, 2021

Is there a way to assign a command or method to a NavigationViewItem inside a NavigationView? I couldnt find soemthing in the samples section.

Thanks

@Ika59
Copy link

Ika59 commented Sep 5, 2023

As Content, we specify UIElement, which can call commands directly, for example, Button:

            <NavigationViewItem>
                <NavigationViewItem.Icon>
                    <FontIcon  Style="{StaticResource EmojiFontIconStyle}" Glyph="{StaticResource Emoji_Command_WhatsNew}"/>
                </NavigationViewItem.Icon>
                <NavigationViewItem.Content>
                    <Button x:Name="WhatsNew_Button" Content="Whats new?" Style="{StaticResource AccentButtonStyle}" Command="{x:Bind ViewModel.AppCommands.WhatsNew_Command}" CommandParameter=""/>
                </NavigationViewItem.Content>
            </NavigationViewItem>

@Ika59
Copy link

Ika59 commented Sep 5, 2023

I put the real code in the running program!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants