Add support for setting content in place of the title in a TitleBar #1030
+116
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: