开发者

How to place button at only one Panorama page (screen)?

开发者 https://www.devze.com 2023-02-17 05:14 出处:网络
I\'m using panorama UI in wp7. I have several panorama screen each containing ListBox. I want to add button only to one pan开发者_开发问答orama page (together with ListBox), and when I move to anothe

I'm using panorama UI in wp7.

I have several panorama screen each containing ListBox. I want to add button only to one pan开发者_开发问答orama 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?


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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号