Set background color for Panorama Title
I would like to set the background color of the title of a panorama. I have done this by creating a DataTemplate and setting it to the TitleTemplate. I then set the background color as such:
<DataTemplate x:Key="PanoramaTitleTemplate">
<Grid Margin="0开发者_运维知识库,50,0,0" Background="{StaticResource PhoneAccentBrush}">
<TextBlock Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" FontSize="133.333" />
</Grid>
</DataTemplate>
The problem is that on the last page of the panorama, the color doesn't fill the whole area. It ends where the text ends. I've tried setting the grid to a longer width, but not only does that still not fill the screen, it affects the title scrolling as well.
Create a DataTemplate for your Panorama Title and set the width of the TextBlock (items * 480):
<DataTemplate x:Key="PanoramaTitleTemplate">
<StackPanel Orientation="Horizontal" Background="#FF990000" Margin="-10 76 0 -9"> <!-- default 10,-76,0,9 -->
<Image x:Name="logoImage" Source="/ApplicationIcon.png" Margin="10 0 30 0" />
<TextBlock Text="{Binding}" VerticalAlignment="Center" Width="1920" Height="40" FontSize="20"/>
</StackPanel>
</DataTemplate>
This is due to the way the title is animated as part of the paralax effect.
You could write your own Panorama replacements but you'll find it much easier to add a separate image to the page instead of to the Panorama and add another item (probably a rectangle) in front of that which you can se to be the accent colour.
精彩评论