如何仅在一个全景页面(屏幕)上放置按钮?

发布于 2024-10-22 06:47:54 字数 156 浏览 5 评论 0原文

我在 wp7 中使用全景 UI。

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事与诗 2024-10-29 06:47:54

枢轴控件具有枢轴项目,因此您可以将按钮添加到仅一个枢轴项目

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

<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>

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>
青衫儰鉨ミ守葔 2024-10-29 06:47:54

您可以为 Panorama 控件本身设置 TitleTemplate 属性,然后将现有静态资源绑定到它。例如:

<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>

这是一个非常基本的示例,但您可以引入自定义绑定。

然后,您可以在控件中引用自定义模板:

<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>

Panorama 控件中,按钮无论如何都会在标题中移动,因此根据您的情况,更好的选择是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文