Benoit
Benoit

Reputation: 1921

How to access a custom Panorama TitleTemplate within c#?

As a title for the Panorama, I use a custom UserControl that I'd like to update from the PhoneApplicationPage. But to do so, I need to access it, I tryed to get the children of the Panorama:

Grid grid = VisualTreeHelper.GetChild(panorama, 0) as Grid;

But it says that panorama has 0 Children. Is it normal? Do you know a way to access a Panorama.TitleTemplate ?

Thanks!

Upvotes: 0

Views: 495

Answers (1)

Claus Jørgensen
Claus Jørgensen

Reputation: 26347

What prevents you from doing this?

<controls:Panorama Title="{Binding}">
    <controls:Panorama.TitleTemplate>
        <DataTemplate>
            <local:MyUserControl DataContext="{Binding}" />
        </DataTemplate>
    </controls:Panorama.TitleTemplate>
    ...
</controls:Panorama>

Upvotes: 1

Related Questions