0

I'm binding Panorama control to my view model (of type ObservableCollection).

I use ItemTemplate. I can't use HeaderTemplate because it makes transition not really smooth (don't know why !! ) Here is my XAML

<controls:Panorama Name="panorama" >
                        <controls:Panorama.ItemTemplate>
                            <DataTemplate>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="210"/>
                                        </Grid.RowDefinitions>
                                        <TextBlock Text="{Binding Name}"/>
                                    </Grid>
                            </DataTemplate>
                        </controls:Panorama.ItemTemplate>
</controls:Panorama>

However, when running, every panorama item does show the Model class name. If I use HeaderTemplate, it doesnot show that. How to fix that ?

onmyway133
  • 45,645
  • 31
  • 257
  • 263

1 Answers1

1

If it's bind on an ObservableCollection property of your ViewModel something's missing. Your Panorama control should have an ItemsSource="{Binding MyObservableCollection}">

If your itemSource is set in the code behing, the quickest way is to set a negative margin to hide your header...

<controls:Panorama Margin="0,-20,0,0">
</controls:Panorama>

Or if you want something a little bit cleaner you can modify your styles for panorama and supress the header... This is Creating Pivot Footers on Windows phone 7 application it works the same way for panorama control

Community
  • 1
  • 1
Pierpowl
  • 299
  • 4
  • 15
  • thanks, I set ItemsSource in code behind, the ItemTemplate is OK. The problem is when I don't set HeaderTemplate, each panorama item shows my Model class name ! – onmyway133 Dec 07 '12 at 09:39
  • OK it's because you supress HeaderTemplate that it displays your model class name. The class name is displayed instead of the header ? Or instead of `Name` – Pierpowl Dec 07 '12 at 10:02
  • The classname is display instead of the header. A more strange is that when I set ItemTemplate header="aaa". It both show "aaa" and Class name !! – onmyway133 Dec 07 '12 at 11:36
  • Okay I've edit my answer, it'ss what you were looking for? I don't know why that behave like this but you can hide it or supress it... – Pierpowl Dec 07 '12 at 13:00
  • the only way to hide it or suppress it is to handle HeaderTemplate. But whenever HeaderTemplate is handled, the panorama swiping is not smooth anymore – onmyway133 Dec 14 '12 at 03:42
  • Hi @entropy I am experiencing the same problem. I read the above comments but couldnt make out whats the exact solution. Can u explain what steps helped u in removing the Class name from header. – Arjun K R Apr 23 '14 at 08:41