丝带窗口上有多余的空间

时间:2013-08-16 01:51:12

标签: c# wpf ribbon

我正在关注教程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

请帮助我改进它!

1 个答案:

答案 0 :(得分:1)

使用RibbonWindow代替Window

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

    <!-- Window Content -->

</RibbonWindow>