0

我在 wp7 中使用全景 UI。

我有几个全景屏幕,每个屏幕都包含 ListBox。我只想将按钮添加到一个全景页面(与 ListBox 一起),当我移动到另一个页面时,我不会在另一个页面上移动按钮。此按钮需要在列表框上方,其功能仅与此列表实例有关,与另一个全景屏幕无关。这有可能实现吗?

4

2 回答 2

4

Pivot 控件具有 Pivot Items,因此您可以将按钮添加到一个 Pivot Item 中

编辑:在枢轴项目(或全景项目)内,您必须使用 Grid 才能有两行,一个是按钮,另一个是列表框

<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>
于 2011-03-15T21:10:51.750 回答
0

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.

于 2011-03-15T21:38:11.743 回答