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

Added empty HeaderTemplate to NavigationView #1655

Merged
merged 1 commit into from
Dec 15, 2017
Merged

Conversation

nmetulev
Copy link
Contributor

Issue: #1644

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build or CI related changes
[ ] Documentation content changes
[ ] Sample app changes
[ ] Other... Please describe:

PR Checklist

Please check if your PR fulfills the following requirements:

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@@ -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>
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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}"/>

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

@nmetulev nmetulev changed the base branch from master to rel/2.1.1 December 6, 2017 21:35
@nmetulev nmetulev changed the base branch from rel/2.1.1 to master December 6, 2017 22:09
@azchohfi azchohfi self-requested a review December 14, 2017 17:23
@nmetulev nmetulev merged commit 467b9cc into master Dec 15, 2017
@nmetulev nmetulev deleted the nmetulev/hamburger branch December 15, 2017 02:14
@windowstoolkitbot
Copy link

This PR is linked to unclosed issues. Please check if one of these issues should be closed: #1644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants