-
-
Notifications
You must be signed in to change notification settings - Fork 744
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
Add support for setting content in place of the title in a TitleBar #1030
base: main
Are you sure you want to change the base?
Conversation
To prevent backward compatibility issues you could have kept Header and just have added LeftHeader. Once there's a major version change that can break backwards compatibility then a name change from Header to RightHeader could be considered without issue |
@537mfb Yes, I'd be happy to submit an update to the pull request to change the naming of |
Given that |
I think you guys are forgetting that "left" and "right" should be swapped when the OS is using a right-to-left language. Better use something like "primary" and "secondary, or something like that. |
That would be setting the PreferredHeightOption to TitleBarHeightOption.Tall |
<ContentPresenter | ||
Grid.Column="0" | ||
HorizontalAlignment="Left" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this property when width=auto
@Jay-o-Way I initially called the renamed properties |
Not sure how easy this would be to achieve but how about having Header on the side of the system buttons (as is now) and make Title work like Content in other controls where if you give a string it works like a textblock but you can give it other arbitrary content. Think of a Label - you can give it a string or a layout with several controls as content |
@537mfb That's essentially what my PR does right now. By default, it's a |
@jonlipsky my idea is slightly different. you could have:
and it would work as it does now. But you could also do:
|
To be honest, I'm not a fan of the division into HeaderLeft and HeaderRight. I would prefer one big Header as a whole Titlebar up to navigation buttons with default value - Icon and Application Name, similar to @537mfb's suggestion |
Any update? |
MAUI apparently now uses the notion of |
If a project admin/leader lets me know their preference as to how they want it to work, I'd happily amend the PR to implement that. I took the initial approach I did because there were other issues/requests asking for it that way. |
@pomianowski is the project owner, so I suppose this reply counts? This PR is awesome though, thanks for creating it @jonlipsky. |
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Currently there is no way to set content in a
TitleBar
that is left justified and/or use content other than the defaultTextBlock
for the title content.Issue Number: [#775] [#1025]
What is the new behavior?
This PR adds support for (optionally) specifying content to be displayed as a replacement for the
TextBlock
which displays the title. The following changes have been made:LeftHeader
property that can be optionally set to specify the view to be presented in place of the defaultTextBlock
that displays the title (when set).TextBlock
is initialized in theTitleBar
constructor and assigned to theLeftHeader
property so that setting the title is still the default behavior.Header
toRightHeader
to make the API more self-documenting as to the purpose of the property.Other information
This change is a breaking change from the previous version since
Header
has been renamed toRightHeader
. One remedy would be to add a new property calledHeader
, which would delegate toRightHeader
and be marked as deprecated to give users time to update their code.One additional enhancement that may be nice to have would be the ability to vertically align the Minimize, Maximize and Close buttons of the window. It may be more aesthetically pleasing to have them center aligned depending on the content in the RightHeader. As an example, JetBrains Rider does this in their custom titlebar: