2013-08-16 65 views
0

我正在關注教程here。 這裏是我的XAML代碼:色帶窗口上的多餘空格

<Window x:Class="warm6.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="MainWindow" Height="350" Width="525"> 
    <Grid> 
     <Grid.RowDefinitions> 
      <RowDefinition Height="Auto"/> 
      <RowDefinition Height="*" /> 
     </Grid.RowDefinitions> 

     <Ribbon x:Name="RibbonWin"> 
      <!-- help icon on the right side --> 
      <Ribbon.HelpPaneContentTemplate> 
       <DataTemplate> 
        <RibbonButton SmallImageSource="images\help.png" /> 
       </DataTemplate> 
      </Ribbon.HelpPaneContentTemplate> 

      <Ribbon.ApplicationMenu> 
       <RibbonApplicationMenu SmallImageSource="images\window.png"> 
        <RibbonApplicationMenuItem Header="Open" ToolTipTitle="Application Menu" 
               ImageSource="images\window2.png"/> 
        <RibbonApplicationMenuItem Header="_Save" 
               ImageSource="images\save.png"/> 
        <RibbonSeparator/> 
        <RibbonApplicationMenuItem Header="_Close" ImageSource="images\close.png"/> 
        <RibbonApplicationMenu.AuxiliaryPaneContent> 
         <Grid> 
          <Grid.RowDefinitions> 
           <RowDefinition Height="Auto" /> 
           <RowDefinition Height="5" /> 
           <RowDefinition Height="*" /> 
          </Grid.RowDefinitions> 
          <RibbonSeparator Grid.Row="0" Label="Recently Templates" /> 
         </Grid> 
        </RibbonApplicationMenu.AuxiliaryPaneContent> 
       </RibbonApplicationMenu> 
      </Ribbon.ApplicationMenu> 

      <RibbonTab> 

      </RibbonTab> 
     </Ribbon> 

    </Grid> 
</Window> 

我發現有多餘的空間,我區窗口上面,像這樣: enter image description here

請幫助我提高了!

+0

嘗試設置'VerticalAlignment = 「評出的」'你的絲帶。 – Nitesh

+0

嘗試過,但沒有效果。 – prehistoricpenguin

+0

僅用於檢查爲功能區和窗口設置不同的背景,並查看此空間屬於哪個控件。 – Nitesh

回答

1

使用的RibbonWindow,而不是Window

<RibbonWindow x:Class="warm6.MainWindow"> 

    <!-- Window Content --> 

</RibbonWindow> 
+0

謝謝你的耐心等待! – prehistoricpenguin

+0

@Nitesh用RibbonWindow替換窗口後出現錯誤錯誤'TestWPF.test'的部分聲明不能指定不同的基類 – user2391685