简体   繁体   中英

Windows Phone 7 Title doesn't exist in Panorama control

I'm developing a Windows Phone 7 application and I'm trying to change the look of the Title element.

All over the internet they show code similar to this:

<controls:Panorama> 
    <controls:Panorama.Title> 
        <StackPanel Orientation="Horizontal" Margins="0,80,0,0"> 
            <Image Source="/myimage.png"/> 
            <TextBlock Text="my title"/> 
        </StackPanel> 
    </controls:Panorama.Title> 
</controls:Panorama>

But when I run it, it just comes up with these errors

The property 'Title' does not exist on the type 'Grid' in the XML namespace 'clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls'. c:\\users\\lukecou\\documents\\visual studio 2010\\Projects\\PanoramaApp2\\PanoramaApp2\\Homepage.xaml 22 10 PanoramaApp2

and

The attachable property 'Title' was not found in type 'Panorama'. c:\\users\\lukecou\\documents\\visual studio 2010\\Projects\\PanoramaApp2\\PanoramaApp2\\Homepage.xaml 22 10 PanoramaApp2

How come the Title element exists for everyone else and not for me?

How do I gain access to it?

Its noteworthy that the error says "The property 'Title' does not exist on the type 'Grid' " why Grid and not Panorama? Its a clue to something else wrong with your real Xaml

Use TitleTemplate instead

<controls:Panorama.TitleTemplate>
    <DataTemplate>
    <StackPanel Orientation="Horizontal" Margin="0,80,0,0"> 
    <Image Source="/myimage.png"/> 
    <TextBlock Text="my title"/> 
    </StackPanel> 
</DataTemplate>     
</controls:Panorama.TitleTemplate>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM