TitleBar.PaneToggleRequested Evento

Definição

Ocorre quando o botão de alternância do painel é invocado.

// Register
event_token PaneToggleRequested(TypedEventHandler<TitleBar, IInspectable const&> const& handler) const;

// Revoke with event_token
void PaneToggleRequested(event_token const* cookie) const;

// Revoke with event_revoker
TitleBar::PaneToggleRequested_revoker PaneToggleRequested(auto_revoke_t, TypedEventHandler<TitleBar, IInspectable const&> const& handler) const;
public event TypedEventHandler<TitleBar,object> PaneToggleRequested;
function onPaneToggleRequested(eventArgs) { /* Your code */ }
titleBar.addEventListener("panetogglerequested", onPaneToggleRequested);
titleBar.removeEventListener("panetogglerequested", onPaneToggleRequested);
- or -
titleBar.onpanetogglerequested = onPaneToggleRequested;
Public Custom Event PaneToggleRequested As TypedEventHandler(Of TitleBar, Object) 

Tipo de evento

Exemplos

<!-- MainWindow.xaml -->

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <TitleBar Title="My App"
              IsPaneToggleButtonVisible="True"
              PaneToggleRequested="TitleBar_PaneToggleRequested">
    </TitleBar>

    <NavigationView x:Name="RootNavigationView" Grid.Row="1"
                    IsPaneToggleButtonVisible="False">
        <Frame x:Name="RootFrame" />
    </NavigationView>
</Grid>
// MainWindow.xaml.cs

private void TitleBar_PaneToggleRequested(TitleBar sender, object args)
{
    RootNavigationView.IsPaneOpen = !RootNavigationView.IsPaneOpen;
}

Comentários

Ao usar o controle TitleBar com um controle NavigationView , você deve substituir o botão de alternância do painel de navegação pelo botão de alternância do painel da barra de título.

É recomendável que você:

  • Oculte o botão de alternância do painel no NavigationView controle. <NavigationView IsPaneToggleButtonVisible="False">
  • Mostrar o botão de alternância do TitleBarpainel no . <TitleBar IsPaneToggleButtonVisible="True">
  • Manipule esse evento para alternar o valor da propriedade NavigationPane.IsPaneOpen .

Não há nenhuma conexão inerente entre o TitleBarbotão de alternância do painel e o NavigationView. O TitleBar botão simplesmente aciona esse evento para permitir que você forneça código para alternar o NavigationViewpainel 's.

Aplica-se a

Confira também