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

Add PaneTitle to NavigationViewTemplateSettings #18

Closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Background
Xaml controls are typically implemented using an element tree that’s defined in a template.
For example the template for a ComboBox control has a TextBlock in it to display the selected value.
Several controls have properties that are only expected to be useful to these templates,
and so there’s a common pattern for the control to expose them in a TemplateSettings property.
For example [ComboBox.TemplateSettings](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.ComboBox.TemplateSettings)
is used by the ComboBox’s template. See [this doc page](https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/template-settings-classes) for more details.

The new API here adds a PaneTitle property to NavigationView's existing
[TemplateSettings property](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.NavigationViewTemplateSettings).
This helps the control template decide if it should show the
[NavigationView.PaneTitle](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.NavigationView.PaneTitle)
property, as it should be ignored if the
[NavigationView.PaneHeader](https://docs.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.NavigationView.PaneHeader)
property is set. (The RS5 PaneHeader property supersedes/replaces the RS4 PaneTitle property.)


# Description
Provides calculated PaneTitle that can be referenced as TemplatedParent sources when defining templates for a NavigationView control. Not intended for general use.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides calculated PaneTitle that can be referenced as TemplatedParent sources when defining templates for a NavigationView control. Not intended for general use.
Provides the calculated PaneTitle that should be displayed by a ControlTemplate.
This will be null if the PaneHeader property is set.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Provides calculated PaneTitle that can be referenced as TemplatedParent sources when defining templates for a NavigationView control. Not intended for general use.
Provides the calculated PaneTitle that should be displayed by a ControlTemplate.
This will be empty if the PaneHeader property is set.


# Examples

```
[webhosthidden]
unsealed runtimeclass NavigationViewTemplateSettings : Windows.UI.Xaml.DependencyObject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an Example, this is the API, and should be in the API Details section. The "sample usage" from the Remarks section should be brought up here.

{
...

{
String PaneTitle{ get; };
static Windows.UI.Xaml.DependencyProperty PaneTitleProperty{ get; };
}
}
```

# Remarks
This is intended for use in the style of the `NavigationView` control. Sample usage:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the template, not in the style

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Templatesetting is used in the style


```xaml
<Style TargetType="local:NavigationView">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a template example.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand? TemplateSettings.PaneTitle example is always in the style

Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneTitle}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used in the ControlTemplate, and the ControlTemplate is typically part of the default Style. (That Text property is on a TextBlock in a ControlTemplate.) PersonPictureSettings (#13) is a good reference.

...
<TextBlock
x:Name="PaneTitleTextBlock"
Grid.Column="0"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=TemplateSettings.PaneTitle}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{StaticResource NavigationViewItemHeaderTextStyle}"/>
```

# API Notes

## Class: NavigationViewTemplateSettings
| Member Name | Description |
|:- |:--|
| PaneTitle | The NavigationView.PaneTitle displayed in the control. Empty when NavigationView.PaneHeader is set |