MVVM, Windows Phone 7

Data Binding Panorama Control WP7 MVVM

by Peter Daukintis

Ok, this is just a quick follow-up to a previous post Data Binding Pivot Control just as confirmation that this approach will work for the WP7 Panorama Control as well. Starting with the project from the previous post, I literally opened the xaml and changed the word ‘pivot’ to ‘panorama’ to end with this:

        <controls:Panorama ItemsSource="{Binding PageCollection}"
                        Title="MY APPLICATION"
                        HorizontalContentAlignment="Stretch"
                        VerticalContentAlignment="Stretch"
                        >
            <controls:Panorama.HeaderTemplate>
                <DataTemplate>
                    <Grid x:Name="grid">
                        <TextBlock TextWrapping="Wrap"
                                   Text="{Binding TitleText}"
                                   d:LayoutOverrides="Width, Height" />
                    </Grid>
                </DataTemplate>
            </controls:Panorama.HeaderTemplate>
            <controls:Panorama.ItemTemplate>
                <DataTemplate>
                    <WindowsPhonePivotApplication1:DataTemplateSelector Content="{Binding}" />
                </DataTemplate>
            </controls:Panorama.ItemTemplate>
        </controls:Panorama>

and that was it!

panobinding

panobinding2

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,

Windows Live Tags: Data,Panorama,Control,MVVM,Beta,Pivot,confirmation,ItemsSource,PageCollection,Title,APPLICATION,HorizontalContentAlignment,Stretch,VerticalContentAlignment,HeaderTemplate,DataTemplate,Grid,Name,TextBlock,Wrap,Text,TitleText,LayoutOverrides,Width,ItemTemplate,DataTemplateSelector,Content

5 thoughts on “Data Binding Panorama Control WP7 MVVM

  1. Hi, could you suggest me: how can I set diffeternt Orientation to generated Panorama Item? I need to have different dataTemplates, so I use your nice trick, but also some of my PanoramaItems must be horisontal oriented.

Leave a Reply

Your email address will not be published. Required fields are marked *