Xaml BottomAppBar通用应用程序中有2个不同的StackPanel

Xaml BottomAppBar通用应用程序中有2个不同的StackPanel,xaml,windows-10,win-universal-app,windows-10-universal,Xaml,Windows 10,Win Universal App,Windows 10 Universal,我试图将元素放在我的底部AppBar中,如下所示: 使用此代码,我得到了左侧的两个StackPanel,请更正我的代码: <Page.BottomAppBar> <CommandBar Background="#eff0f2"> <CommandBar.Content> <Grid HorizontalAlignment="Stretch">

我试图将元素放在我的底部AppBar中,如下所示:

使用此代码,我得到了左侧的两个StackPanel,请更正我的代码:

<Page.BottomAppBar>
        <CommandBar Background="#eff0f2">
            <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/1.png" Height="35" Width="35" />
                        <ComboBox Margin="2" BorderThickness="0" SelectedItem="Français">
                            <ComboBoxItem Content="Français" />
                            <ComboBoxItem Content="Anglais" />
                        </ComboBox>
                        <Button VerticalAlignment="Stretch" Background="#eff0f2" >
                            <Button.Content>
                                <TextBlock Text="Conditions des données" Foreground="#336699"></TextBlock>
                            </Button.Content>
                        </Button>
                        <Button VerticalAlignment="Stretch" Background="#eff0f2" Margin="0">
                            <TextBlock Text="-Mentions légales" Foreground="#336699"></TextBlock>
                        </Button>
                        <Button VerticalAlignment="Stretch" Background="#eff0f2" Margin="0">
                            <TextBlock Text="-Impressum" Foreground="#336699"></TextBlock>
                        </Button>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"  Grid.Row="0" Grid.Column="1" >
                        <Image Source="images/marque.png" Height="35" Width="35"  />
                        <TextBlock Text="2015 OAASE Corporation|All Right Reserved." Foreground="#666666" Margin="10" />
                    </StackPanel>
                </Grid>
            </CommandBar.Content>
        </CommandBar>
    </Page.BottomAppBar>


感谢您的帮助:)

您只需将Stretch HorizontalContentAlignment添加到CommandBar:

<CommandBar HorizontalContentAlignment="Stretch">

编辑: @user3821206,解决您的响应问题的一个快速方法是将第一列的最小宽度设置为自动,并将第二列的宽度设置为自动。当屏幕太小时,将裁剪右侧部分:

<Grid.ColumnDefinitions>
    <ColumnDefinition MinWidth="550" Width="*" />
    <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

更好的补充修复方法是使用VisualStateManager和AdaptiveTrigger。例如,如果屏幕大小小于720,则可以隐藏右侧面板。为此,请为右侧Stackpanel命名:

<StackPanel x:Name="RightPanel"

当我在Thank t.ouvre中使用AppBar时,这是否可能?当我展开屏幕时,它工作得很好,但当屏幕很小时,右侧的StackPanel不在右侧,它会干扰左侧的StackPanel
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <!-- Start of snippet -->
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup>
            <VisualState>
                <!-- Edit style for small screen -->
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="0" />
                </VisualState.StateTriggers>
                <VisualState.Setters>
                    <Setter Target="RightPanel.Visibility"
                            Value="Collapsed" />
                </VisualState.Setters>
            </VisualState>
            <VisualState>
                <!-- Disable previous changes for large screen -->
                <VisualState.StateTriggers>
                    <AdaptiveTrigger MinWindowWidth="720" />
                </VisualState.StateTriggers>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <!-- End of snippet -->
</Grid>