WP7 Pivot’s TitleTemplate contains Title & Subtitle
I tried to add to Textblocks to the Pivot':TitleTemplate and got an error "The property 'VisualTree' is set more than once." In order to work around this, I had to add a containing object (Stackpanel) that could contain both objects.
In order to do that, create a TitleTemplate that contains a StackPanel with your Title and Subtitle Textblocks inside. The image below shows the Title and Subtitle above the pivot header.
The XAML to produce this is below:
In order to do that, create a TitleTemplate that contains a StackPanel with your Title and Subtitle Textblocks inside. The image below shows the Title and Subtitle above the pivot header.
The XAML to produce this is below:
1: <controls:Pivot.TitleTemplate>
2: <DataTemplate>
3: <StackPanel>
4: <TextBlock x:Name="TextBlockPivotDeploymentItemHeading"
5: Text="Title"
6: FontSize="20"
7: TextWrapping="Wrap"/>
8: <TextBlock x:Name="subtitle"
9: Text="Subtitle"
10: Foreground="Gray"
11: TextWrapping="Wrap"/>
12: </StackPanel>
13: </DataTemplate>
14: </controls:Pivot.TitleTemplate>
Comments
Post a Comment