Archive

Posts Tagged ‘Panorama control’

Silverlight for Windows Phone 7: Change panorama control’s title

June 29th, 2011 No comments

     You can easily change the look of Panorama-control title by applying TitleTemplate:

<controls:Panorama Title="my pano">
    <controls:Panorama.TitleTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding}" FontSize="100" Margin="0,50,0,0" />
        </DataTemplate>
    </controls:Panorama.TitleTemplate>
</controls:Panorama>

This piece of xaml allows to get the title smaller.

Panorama Title before

Before

After

Pay attention to Margin-attribute stated above. The default attributes for Panorama title is

Margin="10,-76,0,9"
FontSize="187"
HorizontalAlignment="Left"

and if you decrease the font size without correction of top-margin, your title can be hidden or clipped by upper bound of the screen.

If you want to add image to the title, use the next sample as the base:

<controls:Panorama.TitleTemplate>
    <DataTemplate>
        <StackPanel Orientation="Horizontal">
            <Image x:Name="logoImage" Margin="0,80,0,0" Source="/ApplicationIcon.png" />
            <TextBlock Text="{Binding}" FontSize="100" Margin="0,50,0,0" />
        </StackPanel>
    </DataTemplate>
</controls:Panorama.TitleTemplate>
Panorama Image TitleTemplate

Image in title

Related posts: