question

72195504 avatar image
0 Votes"
72195504 asked RoyLi-MSFT edited

How can i hide Navigation Bar? c++ UWP

Hi,
I have created UWP project(for universal apps c++). I had a problem with Navigation Bar, I cannot hide it. Early, I use UPF for c# there hide this bar is very simple. Needed only write WindowStyle="None" but how can I do this in UWP project?

my code:
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background = "#393E46">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
</Grid>
</Page>

windows-uwp
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@72195504 Hope you've been well. Have you checked my answer?

0 Votes 0 ·

1 Answer

RoyLi-MSFT avatar image
0 Votes"
RoyLi-MSFT answered

Hello,

Welcome to Microsoft Q&A!

How can i hide Navigation Bar?

I checked the code, there is no Navigation bar in your app. It seems that you are trying to hide Title bar, right?

The first thing is to hide the default title bar and extend your content into the title bar area. What you need to do is set the CoreApplicationViewTitleBar.ExtendViewIntoTitleBar property that extends app content into the title bar area to true.

System caption buttons(minimize, maximize/restore, close) can't be hidden, but you could change the look of the system caption buttons and make them to be transparent by setting some of the color properties of the ApplicationViewTitleBar(the default title bar)

I'm not sure if you are using C++/CX or C++/WinRT.

Here is the code for C++/CX:

    using namespace Windows::UI::ViewManagement;
 using namespace Windows::UI;
 using namespace Windows::ApplicationModel::Core;

 auto  _coreTitleBar = CoreApplication::GetCurrentView()->TitleBar;
 _coreTitleBar->ExtendViewIntoTitleBar = true;

 auto _TitleBar = ApplicationView::GetForCurrentView()->TitleBar;

 _TitleBar->ButtonBackgroundColor = Colors::Transparent;
 _TitleBar->ButtonInactiveBackgroundColor = Colors::Transparent;
 _TitleBar->ButtonPressedBackgroundColor = Colors::Transparent;
 _TitleBar->ButtonHoverBackgroundColor = Colors::Transparent;

For more information, you could take a look at this document: Title bar customization. And sample here: Title bar sample

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.






5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.