When I add a custom title bar, it does not respond to user actions.
But remove TextBlock
, It is OK.
I have added these code in app.xaml.cs
OnLaunched()
:
//draw into the title bar
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
//remove the solid-colored backgrounds behind the caption controls and system back button
ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonBackgroundColor = Colors.Transparent;
titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
titleBar.ButtonForegroundColor = Colors.Black;
Xaml:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<NavigationView x:Name="NavView" AlwaysShowHeader="False" SelectionChanged="NavView_SelectionChanged" DisplayModeChanged="NavView_DisplayModeChanged">
<NavigationView.MenuItems>
<NavigationViewItem Content="Home" Tag="home">
<NavigationViewItem.Icon>
<FontIcon Glyph=""/>
</NavigationViewItem.Icon>
</NavigationViewItem>
</NavigationView.MenuItems>
<NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="ASB" QueryIcon="Find"/>
</NavigationView.AutoSuggestBox>
<Frame x:Name="ContentFrame" Margin="24">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition/>
</TransitionCollection>
</Frame.ContentTransitions>
</Frame>
</NavigationView>
<TextBlock x:Name="AppTitle" Style="{StaticResource CaptionTextBlockStyle}" Text="Test"/>
</Grid>