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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

</DataTemplate>
</NavigationView.HeaderTemplate>
<ContentPresenter x:Name="ContentPart"
AutomationProperties.Name="Content"
Content="{TemplateBinding Content}" />
Expand Down