maui icon indicating copy to clipboard operation
maui copied to clipboard

Blazor Hybrid templates have an empty title bar

Open Eilon opened this issue 1 year ago • 6 comments

The default Blazor Hybrid templates have an empty window title bar. The regular .NET MAUI templates have the app's name in the title bar.

Blazor Hybrid, even if I set the ContentPage's Title .NET MAUI
Image Image
Taskbar (no title) Taskbar (has title)
Image Image

I'm not sure the right way to fix this. It seems that the Shell control picks up the title and makes it the app window's title. But without Shell I'm not sure how to do it.

Eilon avatar Oct 17 '24 00:10 Eilon

Looks like its this: https://github.com/dotnet/maui/blob/f86bf4771a828a41358818f10f9498870acd5524/src/Controls/src/Core/Window/Window.cs#L110

We only cast it to Shell and take that title, but don't do it for any other page type?

The other thing we could to is set the title in the App.xaml.cs when we create a new window but I don't think that's a great solution as you'll have another separate place where you need to set a title.

jfversluis avatar Oct 17 '24 07:10 jfversluis

~Added a potential fix here: #25338 lets try the resulting binaries and see if that has the desired effect.~ Also cc: @PureWeen

Verified this works, see PR.

jfversluis avatar Oct 17 '24 07:10 jfversluis

The default Blazor Hybrid templates have an empty window title bar. The regular .NET MAUI templates have the app's name in the title bar.

Blazor Hybrid, even if I set the ContentPage's Title .NET MAUI Image Image Taskbar (no title) Taskbar (has title) Image Image I'm not sure the right way to fix this. It seems that the Shell control picks up the title and makes it the app window's title. But without Shell I'm not sure how to do it.

All shell does it set it on the Window

The guidance here for users has been to just set it on the Window itself

every element in the hierarchy has access to the window so it can set it that way.

Now that we make people override CreateWindow you can set it there

https://github.com/dotnet/maui/pull/25338#issuecomment-2422908977

PureWeen avatar Oct 17 '24 18:10 PureWeen

Hi @Eilon. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

See new attempt here: https://github.com/dotnet/maui/pull/25387

Eilon avatar Oct 18 '24 17:10 Eilon

9.0.1xx PR: #25426

Eilon avatar Oct 21 '24 18:10 Eilon

Fixed by #25426

Eilon avatar Oct 22 '24 16:10 Eilon