Xaml 默认情况下,AppBar具有左右边距

Xaml 默认情况下,AppBar具有左右边距,xaml,windows-8,winrt-xaml,Xaml,Windows 8,Winrt Xaml,我有一个带网格的Windows应用商店应用程序BottomAppBar。由于某些原因,AppBar有一些我不想要的左右边距。这是metro应用程序中的错误还是下面的代码中缺少一些设置 <common:LayoutAwarePage.BottomAppBar> <AppBar> <AppBar.Background> <SolidColorBrush Color="Black" Opacity="0"

我有一个带网格的Windows应用商店应用程序BottomAppBar。由于某些原因,AppBar有一些我不想要的左右边距。这是metro应用程序中的错误还是下面的代码中缺少一些设置

<common:LayoutAwarePage.BottomAppBar> 
   <AppBar>           
<AppBar.Background>             
<SolidColorBrush Color="Black" Opacity="0"/>            
</AppBar.Background>           
 <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> 
           <Grid.Background>   
             <SolidColorBrush Color="Black" Opacity="0.7"/> 
           </Grid.Background> 
           <Button Content="Hello"/> 
       </Grid>      
 </AppBar>  
 </common:LayoutAwarePage.BottomAppBar>


如果运行应用程序,您可以看到左右两侧的某些区域未被AppBar(或网格)覆盖。为什么?

似乎
AppBar
控件的默认模板有一些左右填充。

您只需将AppBar的
Padding
属性设置为
0

似乎
AppBar
控件的默认模板有一些左右填充。

您只需将AppBar的
Padding
属性设置为
0

我假设存在左右填充,这样就不会在屏幕边缘附近绘制控件

不管怎样,正如@Mark所说,只需调整填充即可

 <Page.BottomAppBar>
    <AppBar Padding='0'>
    <AppBar.Background>
      ...

...

我假设有左右填充,这样控件就不会在屏幕边缘附近绘制

不管怎样,正如@Mark所说,只需调整填充即可

 <Page.BottomAppBar>
    <AppBar Padding='0'>
    <AppBar.Background>
      ...

...

谢谢。成功了。另外,将边距设置为-10,-2也可以,但无论如何,设置填充似乎是正确的方法。谢谢。成功了。同样,将边距设置为-10,-2也可以,但无论如何,设置填充似乎是正确的方法。