'.net maui windows titlebar
I was experimenting with the new .net maui preview 13 and I created a new app, but for some reason the title bar on windows is looking weird
As you can see the the title bar is grey (not white) and it is thicker than normal (normally it is as thick as the three buttons) and there is no icon like the other .net app, So is this behavior normal and if so how can I change the title bar color and size?
Note: after some investigation I discovered that this only occurs with the content page
Solution 1:[1]
This was in error and is essentially a bug. With this PR that is now open it will be fixed and the title bar will look "normal" by default and gives you all the flexibility to style the title bar anyway you want.
This will probably be available from RC2
Solution 2:[2]
The height or any other size i think it depends on the platform you are running your App. I'm not sure that can be done.
But for colors you can try this. Add to App.xaml:
<Application>
<Application.Resources>
<ResourceDictionary>
<Color x:Key="PrimaryColor">#242A75</Color>
<Color x:Key="SecondaryColor">White</Color>
...
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="Black"></Setter>
<Setter Property="BarTextColor" Value="{DynamicResource SecondaryColor}" />
</Style>
...
</ResourceDictionary>
</Application.Resources>
</Application>
That will set Titlebar background color to Black, and text to your predefined SecondaryColor defined. This will apply to all the titlebars in your app.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gerald Versluis |
Solution 2 | Juan Ignacio AvendaƱo Huergo |