-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Added empty HeaderTemplate to NavigationView #1655
Conversation
@@ -161,6 +161,11 @@ | |||
IsSettingsVisible="False" | |||
IsPaneToggleButtonVisible="{Binding HamburgerVisibility, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource VisibilityToBoolConverter}}" | |||
Header="{x:Null}"> | |||
<NavigationView.HeaderTemplate> | |||
<DataTemplate> | |||
<Grid></Grid> |
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.
Won't this require users to set a HeaderTemplate? Meaning that even if they set a Header that it will not show?
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.
The HamburgerMenu doesn't have a header, there is no way to modify it without re-templating it anyway
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.
So this wouldn't be needed then. If the Header of the NavigationView isn't being set there is no need for a HeaderTemplate
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.
Just tried it. Looks like the NavigationView has a default template for the Header, so if you don't specify anything, it binds a TextBlock to the DataContext by default
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.
That's standard. But the Content of the HeaderTemplate should be set to the Header itself
<ContentPresenter Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}"/>
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.
Not sure what you mean, the HamburgerMenu doesn't have a Header and HeaderTemplate
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.
Yes, that would be for the NavigationView. There shouldn't be any reason to set an empty header template because the header content would be null
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.
I'm probably doing something wrong, I haven't been able to get it work any other way other then setting a blank template. Setting Header to null doesn't work. Setting header to an empty grid doesn't work.
This PR is linked to unclosed issues. Please check if one of these issues should be closed: #1644 |
Issue: #1644
PR Type
What kind of change does this PR introduce?
PR Checklist
Please check if your PR fulfills the following requirements:
Does this PR introduce a breaking change?
Other information