Custom Image in Windows Phone Panorama

By default a windows Phone Panorama can only accept a title. What if we want an image instead?
To add the image, we have to define the TitleTemplate attribute.

<Grid x:Name="LayoutRoot">
<controls:Panorama x:Name="panorama">
	<controls:Panorama.TitleTemplate>
		<DataTemplate>
                   <!--<TextBlock Text="Families" FontSize="90" Margin="0,50,0,0" />-->
		   <Image HorizontalAlignment="Right" Margin="0,80,200,0" Width="100" Height="100"  Source="/ApplicationIcon.png"/>
                </DataTemplate>
       </controls:Panorama.TitleTemplate>
...

Notes that we added a right margin of 200px. Without it, a small image will be repeated for each item of the panorama. It’s better to add a big image larger than the width of the screen.

You may also like...

Laisser un commentaire