【问题标题】:a TopAppbar and BottomAppBar for WindowsPhoneWindowsPhone 的 TopAppbar 和 BottomAppBar
【发布时间】:2015-12-22 14:02:06
【问题描述】:

我的通用应用程序中有一个 TopAppbar 和 BottomAppBar,我想在我的 windows phone 8 中创建相同的 AppBars,这是我的代码:

<Page.TopAppBar>
        <CommandBar HorizontalContentAlignment="Stretch" Background="#FF00AEEF">
            <CommandBar.Content >
                <Grid>
                    <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Left">
                        <StackPanel Orientation="Horizontal" >
                            <Image Margin="2" Height="35" Source="images/4.png" Width="35"/>
                        </StackPanel>
                        <Button VerticalAlignment="Stretch" Background="#FF00AEEF" x:Name="HomeBtn" Click="HomeBtn_Click">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="images/berry.png" Height="35" Width="35" />
                                <TextBlock Text="BarBerry"  Foreground="White"></TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <Button VerticalAlignment="Stretch" Background="#FF00AEEF" Style="{StaticResource CustomButtonStyle}" Margin="5,0">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Contact" Foreground="White"></TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </Grid>
            </CommandBar.Content>
        </CommandBar>
    </Page.TopAppBar>

    <Page.BottomAppBar>
        <CommandBar Background="#eff0f2" HorizontalContentAlignment="Stretch">
            <CommandBar.Content>
                <Grid HorizontalAlignment="Stretch">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" VerticalAlignment="Stretch">
                        <Image Source="images/world.png" Height="35" Width="35" Margin="5,0"/>
                        <ComboBox Margin="2" BorderThickness="0" SelectedItem="test" x:Name="combo">
                            <ComboBoxItem Content="test" />
                            <ComboBoxItem Content="test1" />
                        </ComboBox>
                    </StackPanel>
                </Grid>
            </CommandBar.Content>
        </CommandBar>
    </Page.BottomAppBar>

但问题是,我只显示了 BottomAppBar,是否可以在 windows Phone 8 中定义一个 Top 和一个 Bottom AppBars,我应该使用 StackPanel 代替 Top appBar 吗?

感谢帮助

【问题讨论】:

    标签: windows-phone-8.1 windows-phone-8-emulator


    【解决方案1】:

    您不能在 windows phone 中创建 顶部应用栏。因为它们只是在 Windows phone 项目中定义的 Bottom App Bar。因此,您只能在 windows phone 中定义底部应用栏。是的,您可以使用 堆栈面板 而不是顶部应用栏,但我认为在 windows phone 中实现这种功能并不是一个好主意:)。

    【讨论】:

      猜你喜欢
      • 2022-10-22
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-01
      • 1970-01-01
      相关资源
      最近更新 更多