C
C#8mo ago
Ikarmus

❔ Modal navigation not showing titlebar

Hi, I'm trying to navigate over ContentPages in .NET MAUI. Navigation.PushModalAsync(newPage) shows new view as intended, but it's missing title bar (and effectively toolbar items). My question is: Should I instantiate new NavigationPage every time I make modal or something like that? That sounds riddiculous, imo the stack should remain the same.
No description
4 Replies
Ikarmus
Ikarmus8mo ago
Here you can see my main page with properly visible toolbaritems
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:DataType="vm:MapPickerViewModel"
Title="Wybór mapy">

<ContentPage.ToolbarItems>
<ToolbarItem Text="Dodaj mapę" IconImageSource="add_fill0_wght400_grad0_opsz24.png" />
<ToolbarItem Text="See Map" IconImageSource="add_fill0_wght400_grad0_opsz24.png" Clicked="ToolbarItem_ShowMap_Clicked" />
</ContentPage.ToolbarItems>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:DataType="vm:MapPickerViewModel"
Title="Wybór mapy">

<ContentPage.ToolbarItems>
<ToolbarItem Text="Dodaj mapę" IconImageSource="add_fill0_wght400_grad0_opsz24.png" />
<ToolbarItem Text="See Map" IconImageSource="add_fill0_wght400_grad0_opsz24.png" Clicked="ToolbarItem_ShowMap_Clicked" />
</ContentPage.ToolbarItems>
No description
Ikarmus
Ikarmus8mo ago
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:DataType="vm:MapEditorViewModel"
Title="cokolwiek">
<ContentPage.ToolbarItems>
<ToolbarItem Order="Primary" Text="Import JSON" Clicked="ImportJSONToolbarBtn_Clicked" />
</ContentPage.ToolbarItems>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:DataType="vm:MapEditorViewModel"
Title="cokolwiek">
<ContentPage.ToolbarItems>
<ToolbarItem Order="Primary" Text="Import JSON" Clicked="ImportJSONToolbarBtn_Clicked" />
</ContentPage.ToolbarItems>
the second snippet represents the page without visible title tab (as seen on first ss https://discord.com/channels/143867839282020352/1163414607885520967/1163414607885520967) Is that intended behaviour and I should instantiate new NavigationPage? Because that's the workaround I've come with after some time, however it doesen't seem right I think it might be bug, just wanted to have some confirmation to file it on github
Ikarmus
Ikarmus8mo ago
await Navigation.PushModalAsync(new MainNavigationPage(new MapEditorPage(query)));
await Navigation.PushModalAsync(new MainNavigationPage(new MapEditorPage(query)));
Using this workaround gives the result I wanted, but it doesn't resolve my problem
No description
Accord
Accord8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.