Question

I'm using panorama UI in wp7.

I have several panorama screen each containing ListBox. I want to add button only to one panorama page (together with ListBox), and when I move to another i don't won't to move the button on another page. This button need to be above list box, with feature concerning only to this instance of list, and not another panorama screen. Is this possible to achive?

Was it helpful?

Solution

Pivot control has Pivot Items, so you can add your button into only one Pivot Item

EDIT: inside pivot item (or panorama item) you have to use Grid to be able to have two rows, button in one and listbox in another

<controls:Pivot Title="MY APPLICATION">
                <!--Pivot item one-->
                <controls:PivotItem Header="item1">
                                    <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Button Grid.Row="0"></Button>
                    <ListBox Grid.Row="1"></ListBox>
                </Grid>

                </controls:PivotItem>

                <!--Pivot item two-->
                <controls:PivotItem Header="item2">
                    <Grid/>
                </controls:PivotItem>
            </controls:Pivot>

OTHER TIPS

You can set the TitleTemplate property for the Panorama control itself and then bind an existing static resource to it. For example:

<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="header">
        <StackPanel>
            <TextBlock Text="Pivot Control">
            </TextBlock>
            <Button Margin="0,0,800,0" Width="200" Content="Test"></Button>
        </StackPanel>
    </DataTemplate>
</phone:PhoneApplicationPage.Resources>

It is a pretty basic sample, but you can introduce custom binding.

Then you can reference the custom template in the control:

<controls:Panorama TitleTemplate="{StaticResource header}">
    <controls:PanoramaItem Header="Main"></controls:PanoramaItem>
    <controls:PanoramaItem Header="Second"></controls:PanoramaItem>
    <controls:PanoramaItem Header="Third"></controls:PanoramaItem>
</controls:Panorama>

In a Panorama control, the button will be moving in the title anyway, so a better choice in your case would be the Pivot control where the title is not moving.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top