2016-02-22 20 views
1

我想盡量減少BottomAppBar的高度,這是我的XAML代碼:減少BottomAppBar的高度在一個通用的應用程序

<Page.BottomAppBar > 
    <CommandBar Background="#393185" 
      Foreground="White" VerticalAlignment="Stretch" Style="{Binding Source={StaticResource Ellipsis}}" Height="40" MaxHeight="40" > 
     <CommandBar.CommandBarOverflowPresenterStyle> 
      <Style TargetType="CommandBarOverflowPresenter"> 
       <Setter Property="Background" 
        Value="#00a0e3" ></Setter> 
       <Setter Property="Margin" Value="0"></Setter> 
       <Setter Property="Padding" Value="0"></Setter> 
       <Setter Property="BorderBrush" Value="Transparent"/> 

      </Style> 
     </CommandBar.CommandBarOverflowPresenterStyle> 
     <CommandBar.PrimaryCommands> 



      <AppBarButton Label="Cortana" 
         Icon="Microphone" 
         Foreground="White" /> 

     </CommandBar.PrimaryCommands> 
     <CommandBar.SecondaryCommands > 
      <AppBarButton Label="Info" 
         Foreground="White" Background="#00a0e3"/> 
     </CommandBar.SecondaryCommands> 
    </CommandBar> 
</Page.BottomAppBar> 

的「Ellepsis」風格是命令欄link 的默認風格,但我所得到的是這樣的結果: enter image description here

我得到的結果是,你可以在圖片中看到的空間(在BottomAppbar的頂部)

其參數應我在此風格的改變,以儘量減少bottomAppBar的內部消除白色空間的高度,我得到的結果

感謝您的幫助

+1

看起來像你需要修改模板。 –

+0

我該怎麼做,爵士,你能解釋一下嗎? – user3821206

+1

看看[控件模板](https://msdn.microsoft.com/en-us/library/windows/apps/mt210948.aspx) –

回答

1

您可以設置的屬性,如果了minHeight要小(默認爲60),所以空白空間被刪除。

<x:Double x:Key="AppBarExpandButtonThemeHeight">48</x:Double> 
<x:Double x:Key="AppBarThemeMinHeight">48</x:Double> 
+0

非常感謝先生它的工作現在:D – user3821206