Reputation: 319
I am working on some WPF app with a main window and with some pages, something weird happened to me, "suddenly" when I move from page 1 to page two this toolbar added himself to my window,
my questions: where did this came from? how to remove/ give it better design, I mean where is the source code of this toolbar
Is this default by Microsoft?
Here is my window class def:
<Window x:Class="Tool.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Tool"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
ResizeMode="CanResizeWithGrip"
MinWidth="600"
MinHeight="500"
Title="Preparation Tool" Height="600" Width="1080" Icon="icon.ico" Foreground="White" >
Upvotes: 2
Views: 522
Reputation: 1557
Where did this came from? How to remove it?
It is a built-in navigation chrome in Frame
control.
According to Microsoft docs, the navigation chrome is visible when a Frame
uses its own journal (see JournalOwnership).
If you don't want that Navigation chrome, you can simply set NavigationUIVisibility
property of your frame to Hidden
.
<Frame NavigationUIVisibility="Hidden" />
If you don't want history navigation management of the current Frame
too, you can set JournalOwnership
property of Frame
to UsesParentJournal
. This makes your Frame
use the journal of the next available navigation host up the content tree, if available. Otherwise, navigation history is not maintained for the Frame
.
<Frame JournalOwnership="UsesParentJournal" />
Or give it a better design? I mean where is the source code of this toolbar?
In Visual Studio (or Visual Studio Blend that I prefer for UI design stuff) simply right-click on your Frame
and then select Edit Template > Edit a copy and put copy of Template in a ResourceDictionary
. Then you can modify the template which it's key is FrameNavChromeTemplateKey.
Is this default by Microsoft?
Yes.
P.S. Do not forget that when you set NavigationUIVisibility="Hidden"
and JournalOwnership="OwnsJournal"
, history management for Frame
itself is still available and you can navigate between pages with commands like Next/Prev mouse buttons.
Upvotes: 3
Reputation: 12276
You can easily hide that:
<Frame NavigationUIVisibility="Hidden"
But you should use contentcontrol instead of frame and usercontrols instead of pages.
Upvotes: 3