Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor Hybrid templates have an empty title bar #25337

Closed
Eilon opened this issue Oct 17, 2024 · 7 comments
Closed

Blazor Hybrid templates have an empty title bar #25337

Eilon opened this issue Oct 17, 2024 · 7 comments
Labels
area-templates Project templates, Item Templates for Blazor and MAUI s/triaged Issue has been reviewed

Comments

@Eilon
Copy link
Member

Eilon commented Oct 17, 2024

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 Eilon added area-blazor Blazor Hybrid / Desktop, BlazorWebView area-templates Project templates, Item Templates for Blazor and MAUI labels Oct 17, 2024
@dotnet-policy-service dotnet-policy-service bot added the s/triaged Issue has been reviewed label Oct 17, 2024
@jfversluis
Copy link
Member

Looks like its this:

string? ITitledElement.Title => Title ?? (Page as Shell)?.Title;

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
Copy link
Member

jfversluis commented Oct 17, 2024

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.

@mkArtakMSFT mkArtakMSFT removed the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Oct 17, 2024
@PureWeen
Copy link
Member

PureWeen commented Oct 17, 2024

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

#25338 (comment)

@PureWeen PureWeen added the s/needs-info Issue needs more info from the author label Oct 18, 2024
Copy link
Contributor

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.

@Eilon Eilon removed the s/needs-info Issue needs more info from the author label Oct 18, 2024
@Eilon

This comment has been minimized.

@Eilon
Copy link
Member Author

Eilon commented Oct 21, 2024

9.0.1xx PR: #25426

@Eilon
Copy link
Member Author

Eilon commented Oct 22, 2024

Fixed by #25426

@Eilon Eilon closed this as completed Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-templates Project templates, Item Templates for Blazor and MAUI s/triaged Issue has been reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants