0

In my Windows Phone application I have:

 <controls:Panorama.ItemTemplate>
                <DataTemplate>
                    <Grid Visibility="{Binding ItemVisibility}" Margin="0,-60,0,0">
                        <ScrollViewer Margin="0,0,0,0"  VerticalAlignment="Top" Height="Auto">
                            <StackPanel Margin="0,0,0,0" Width="Auto"  >
                                <RichTextBox x:Name="Browser"  IsReadOnly="True" Foreground="Black" Height="Auto" cxi:WebBrowserHelper.Html="{Binding BrowserHtml}"  HorizontalAlignment="Left"   Width="460" Margin="0,0,0,0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" />
                                <Canvas Height="100" Width="0" />
                            </StackPanel>
                        </ScrollViewer>
                    </Grid>
                </DataTemplate>
            </controls:Panorama.ItemTemplate>

How can I make Orientation of PanoramaItem - Orientation = "Horizontal"?

I have tried:

<controls:Panorama.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
        </controls:Panorama.ItemsPanel>

But there is NullReference Exeption

revolutionkpi
  • 2,632
  • 10
  • 45
  • 84

1 Answers1

0

First of all it sounds a little odd. The items inside of panorama controls shouldn't be large in width, also you shouldn't have a horizontal scrolling there, because it might spoil the User Experience (will the user be scrolling the content inside of PanoramaItem or the Panorama itself to switch to another PanoramaItem)

Instead of modifying the ItemsPanel Template, you can just modify the StackPanel in the content of PanoramaItem. Something like that:

<StackPanel Margin="0,0,0,0" Width="Auto" Orientation="Horizontal"  > 
                                    <RichTextBox x:Name="Browser"  IsReadOnly="True" Foreground="Black" Height="Auto" cxi:WebBrowserHelper.Html="{Binding BrowserHtml}"  HorizontalAlignment="Left"   Width="460" Margin="0,0,0,0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" /> 
                                    <Canvas Height="100" Width="0" />
</StackPanel>
Jevgeni Tsaikin
  • 321
  • 1
  • 5