0

I'm using a pivot control and binding my collection of images to it. I'm having a problem with alignment of the photos.

If all the photos are landscape, they align at the top, and I am unable to use the gesture control anywhere below the photo.

If they are a mix of portrait/landscape, the images appear ok, until I rotate the device. Then the portrait images are extremely zoomed in, and the landscape images are located half way down the screen.

I'm new to WP7 development and the layout is still pretty foreign to me. Any assistance would be appreciated. I'm sure someone has to have created a basic photo viewer like this....

        <controls:Pivot Name="photoPivot" Loaded="photoPivot_Loaded"
            ItemsSource="{Binding _photos}">
            <controls:Pivot.HeaderTemplate>
                <DataTemplate>
                    <Grid Height="1" Width="1"/>
                </DataTemplate>
            </controls:Pivot.HeaderTemplate>
            <controls:Pivot.ItemTemplate>
                <DataTemplate>

                    <Image VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="{Binding photo_link}" />

                </DataTemplate>
            </controls:Pivot.ItemTemplate>
            <controls:Pivot.ItemContainerStyle>
                <Style TargetType="controls:PivotItem">
                    <Setter Property="Margin" Value="0"/>
                    <Setter Property="Padding" Value="0"/>                        
                </Style>
            </controls:Pivot.ItemContainerStyle>
        </controls:Pivot>
earthling
  • 5,084
  • 9
  • 46
  • 90
  • Your questions aside—having lots of items in a pivot can greatly impact performance. This is therefore not a particularly good way to show a large number of images. – Matt Lacey Feb 18 '11 at 14:23
  • thanks for your comment. I'll take that into consideration. I originally implemented this using an array and the gesture events. Perhaps I'll go back to that. I'll still need to figure out the alignment issues :s – earthling Feb 21 '11 at 06:43

1 Answers1

0

I was able to solve this by removing all height/width definitions from the grid in the data template and the LayoutRoot grid.

earthling
  • 5,084
  • 9
  • 46
  • 90