-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update .NET MAUI template to provide a window with a default title set #12646
Comments
This is most likely related to #11263 |
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;
} |
Hi @vsfeedback. 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. |
I think this needs a repro
<Shell
x:Class="MauiApp3.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiApp3"
Shell.FlyoutBehavior="Disabled"
Title="Maui APP">
protected override Window CreateWindow(IActivationState activationState)
{
var window = base.CreateWindow(activationState);
window.Title = ".NET MAUI";
return window;
} |
@mattleibow I think this binding should be the built-in behaviour |
@BrandonStudio what behavior? You should be able to use all the available APIs to achieve what you need to. |
Hi @vsfeedback. 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. |
@PureWeen what you have said in #11263 (comment). |
Hi @vsfeedback. 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. |
It currently already does this with
I don't think we can provide a default title arrangement based on current page/window title. Everyone will have different requirement for setting the title. |
As you say, there is no problem on title? |
@BrandonStudio not sure what you are setting to see the issue. If you are using the NavigationPage then you will need to set protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == WindowProperty.PropertyName)
Window?.SetBinding(Window.TitleProperty, new Binding("CurrentPage.Title", source: this) { StringFormat = ".NET MAUI {0}" });
} In order for a more dynamic title, you will have to add the binding. We can't really set some defaults as this is often very different per app. Some one a static title on the Window because the app is not a document based. Others want |
@mattleibow What I meant by "default" is that the title shows (not empty) without manually configuration. |
@BrandonStudio I don't think automatically propagating the default title up would be a safe move. Anytime that you add default behavior it's tricky for users to unwind. What if you want a blank title? I updated the description on here so we can update our templates to include a window approach which I think will be more discoverable for people. Maybe we add that code into the templates? |
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. |
Could you share us a sample project to repro this issue? Thanks. |
I think this has been fixed in the meantime. |
This issue has been moved from a ticket on Developer Community.
No title on title bar nor on task bar
Title only appears inside the application, on the top of NavigationPage or of Shell
The text was updated successfully, but these errors were encountered: