зеркало из https://github.com/telerik/maui-docs.git
1.6 KiB
1.6 KiB
title | page_title | description | position | slug |
---|---|---|---|---|
Commands | .NET MAUI NavigationView Documentation - Commands | The .NET MAUI NavigationView provides commands that allow you to initiate open or close actions for the pane. | 12 | navigationview-commands |
.NET MAUI NavigationView Commands
The .NET MAUI NavigationView provides commands that allow you to initiate open or close actions for the pane and toggle its state.
The available commands are:
OpenPaneCommand
(ICommand
)—Gets the command which opens the pane.ClosePaneCommand
(ICommand
)—Gets the command which closes the pane.TogglePaneCommand
(ICommand
)—Gets the command which opens and closes the pane.
Here is an example how to use the commands:
1. Bind the NavigationView commands to buttons command:
<HorizontalStackLayout Spacing="5">
<Button Text="Open Pane" Command="{Binding OpenPaneCommand, Source={x:Reference navigationView}}"/>
<Button Text="Close Pane" Command="{Binding ClosePaneCommand, Source={x:Reference navigationView}}"/>
<Button Text="Toggle Pane" Command="{Binding TogglePaneCommand, Source={x:Reference navigationView}}"/>
</HorizontalStackLayout>
2. Define the NavigationView control:
3. Add the telerik
namespaces:
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"