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

Shell.Title and Window.Title currently doesn't propagate to the catalyst window title #11263

Closed
PureWeen opened this issue Nov 10, 2022 · 8 comments · Fixed by #14399
Closed
Assignees
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-7.0.92 Look for this fix in 7.0.92! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)

Comments

@PureWeen
Copy link
Member

PureWeen commented Nov 10, 2022

Description

The title on the window and shell component don't currently propagate to the UIScene title property.

Here's an example of a workaround
https://github.com/PureWeen/dotnetConfDemo2022/blob/main/dotnetConfDemo/Windows/ScopedWindow.cs#L35

@PureWeen PureWeen added the platform/macOS 🍏 macOS / Mac Catalyst label Nov 10, 2022
@PureWeen PureWeen added this to the Backlog milestone Nov 10, 2022
@ghost
Copy link

ghost commented Nov 10, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@PureWeen PureWeen added the legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) label Nov 10, 2022
@samhouts samhouts added the t/bug Something isn't working label Jan 5, 2023
@mattleibow
Copy link
Member

mattleibow commented Jan 16, 2023

This is most likely related to #12646

@mattleibow
Copy link
Member

Seems the Title is not bubbled up, but thisis also partially by design as some apps do not wish the APP title to match the current page.

If you do, you could maybe put something like this in your shell code-behind (AppShell.xaml.cs):

protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
    base.OnPropertyChanged(propertyName);

    if (propertyName == WindowProperty.PropertyName)
        Window?.SetBinding(Window.TitleProperty, new Binding("CurrentItem.Title", source: this) { StringFormat = ".NET MAUI {0}" });
}

If you want a fixed title for the app, then this is also possible if you put this in your app code-behind (App.xaml.cs):

protected override Window CreateWindow(IActivationState activationState)
{
    var window = base.CreateWindow(activationState);
    window.Title = ".NET MAUI";
    return window;
}

@mattleibow mattleibow added the s/needs-info Issue needs more info from the author label Jan 16, 2023
@ghost
Copy link

ghost commented Jan 16, 2023

Hi @PureWeen. 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.

@mattleibow
Copy link
Member

@PureWeen is this still a thing? I feel like Window.Title now works and I am not sure if Shell.Title going to Window.Title is 100% desired as most apps don't flip title based on the current page... But maybe I am wrong. I have a workaround that may be a feature?

@PureWeen
Copy link
Member Author

@PureWeen is this still a thing? I feel like Window.Title now works and I am not sure if Shell.Title going to Window.Title is 100% desired as most apps don't flip title based on the current page... But maybe I am wrong. I have a workaround that may be a feature?

You only have one Shell for your window so the Shell and the window are synonymous. The Title for the Page itself will be set on the ShellContent or the Page itself.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Jan 16, 2023
@PureWeen
Copy link
Member Author

PureWeen commented Jan 16, 2023

Seems the Title is not bubbled up, but thisis also partially by design as some apps do not wish the APP title to match the current page.

Yes, it is? Maybe I'm not following you here though but the Title is definitely bubbled up.
Yea, the property isn't bubbled up through the Bindable Properties. The Title is exposed through the ITitledElement core interface which reads from shell if it's set otherwise it reads from the window.

https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/HandlerImpl/Window/Window.Impl.cs#L107

image

Here's the watching of the property change

https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/HandlerImpl/Window/Window.Impl.cs#L635-L639

We don't really expose Window in any simplified way currently, so if you're not using shell setting the app title is confusing.
I assume some day we'll include a Window.xaml file with our templated projects and stop using App.MainPage = new MainPage()

@PureWeen
Copy link
Member Author

PureWeen commented Jan 17, 2023

most apps don't flip title based on the current page...

They usually do based on context and for accessibility reasons. Ideally your window title will append/include the context of where you are in an app, that way if you have multiple windows, or you have multiple instances of an app, the screen reader + window.title will give your window context.

For example, every window of your browser bases the title on the currently visible page.

Notepad will prefix the filename.

The Window.Title should probably be an attached property like how we do NavigationPage.Title

@Eilon Eilon added t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK) area-controls-shell Shell Navigation, Routes, Tabs, Flyout and removed legacy-area-desktop Windows / WinUI / Project Reunion & Mac Catalyst / macOS specifics (Menus & other Controls)) labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout fixed-in-7.0.92 Look for this fix in 7.0.92! fixed-in-7.0.100 fixed-in-7.0.101 fixed-in-8.0.0-preview.4.8333 Look for this fix in 8.0.0-preview.4.8333! platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 s/needs-attention Issue has more information and needs another look t/bug Something isn't working t/desktop The issue relates to desktop scenarios (MacOS/MacCatalyst/Windows/WinUI/WinAppSDK)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants