-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
When using controls as header and heradericon like so:
<NavigationBar.HeaderIcon>
<PathIcon Data="{StaticResource list_regular}"
Foreground="{DynamicResource IconColor}" />
</NavigationBar.HeaderIcon>
<NavigationBar.Header>
<Button Content="Header"
Background="#00000000"></Button>
</NavigationBar.Header>and having a TabPage (which also shows them in its tab)
you get a runtime exception:
System.InvalidOperationException: The control Button (Content = Header) already has a visual parent ContentPresenter (Name = PART_ContentPresenter, Host = ContentControl) while trying to add it as a child of ContentPresenter (Name = PART_ContentPresenter, Host = TransitioningContentControl (Name = PART_Header)).
To mitigate this, I propose to introduce two additional properties:
NavigationBar.HeaderIconTemplateNavigationBar.HeaderTempalte
You can then use these to setup your view like:
....
NavigationBar.Header="My Activities"
NavigationBar.HeaderIcon="{StaticResource activity_regular}">
<NavigationBar.HeaderIconTemplate>
<DataTemplate x:DataType="StreamGeometry">
<PathIcon Data="{Binding .}" />
</DataTemplate>
</NavigationBar.HeaderIconTemplate>
<NavigationBar.HeaderTemplate>
<DataTemplate x:DataType="{x:Type system:String}">
<TextBlock Text="{Binding .}" />
</DataTemplate>
</NavigationBar.HeaderTemplate>and you're good to go.
As far as I understand, this should also be backward compatible.
PR is following! I hope you like it @OmidID :-)
Metadata
Metadata
Assignees
Labels
No labels
