WPF窗口边框怪怪的与色带控制 [英] WPF window border acting weird with Ribbon Control

查看:292
本文介绍了WPF窗口边框怪怪的与色带控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WPF中的功能区控制,我发现有2个不同的版本。

I am using the Ribbon control in WPF and I noticed there are 2 different versions.


  1. 使用Microsoft.Windows。 Controls.Ribbon;

  1. using Microsoft.Windows.Controls.Ribbon;


  • 如果我用这一个在我的XAML和类,我的整个窗口将在一个很旧的Windows风格

使用System.Windows.Controls.Ribbon;

using System.Windows.Controls.Ribbon;


  • 如果我在XAML和类中使用这一块,我突然Ribbontabs将无法正确填写了。

当我使用他们两个。有了这个:

When I use both of them. With this:

<ribbon:RibbonWindow x:Class="WPSDashboard.Views.ShellWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"
        xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" 
        xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism" 
        Title="WPSDashboard"
        x:Name="RibbonWindow"
        Width="640" Height="480">


    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Ribbon Region -->
        <r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion">
            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu SmallImageSource="Images\SmallIcon.png">
                    <r:RibbonApplicationMenuItem Header="Exit"
                                                      x:Name="MenuItemExit"
                                                      ImageSource="Images\Exit.png"
                                                      Command="{Binding ExitCommand}"/>
                    </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>
        </r:Ribbon>

        <Grid x:Name="ClientArea" Grid.Row="1">                   

            <!-- Workspace Region-->
            <GridSplitter HorizontalAlignment="Left" Width="2" Grid.Column="1"/>
            <ContentControl x:Name="WorkspaceRegion" Grid.Column="1" prism:RegionManager.RegionName="WorkspaceRegion" />
        </Grid>

    </Grid>
    </ribbon:RibbonWindow>



我Ribbontabs将加载但窗口现在看起来像这样:
我无法点击在关闭和最小化和最大化。 < ---

My Ribbontabs will load but the window now looks like this: I can't click on close and minimize and maximize. <---

我怎样才能获得的边界是正常的,而不是小?

我无法关闭我的窗口这种方式。

How can I get the border to be normal instead of small?
I can't close my windows this way.

推荐答案

我发现使它看起来和工作的好!

I found the best way to make it look and work good!

除了标签的<丝带:RibbonWindow 在XAML的开始,
让它<窗​​口结果
也添加此部分:

Instead of the tags <ribbon:RibbonWindow on the beginning of the xaml, Make it <Window .
Also add this part:

xmlns:r="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"

然后在你的类中删除你的:RibbonWindow (如果它的存在)

Then in your class delete your : RibbonWindow (If it's there)

如果不工作,你不需要快访问工具栏,这可能会帮助:
回到你的XAML,并更换色带保证金-22:

If that doesn't work and you don't need the quick access toolbar, this may help: Go back to your XAML, and change the Ribbon margin to -22 :

 <r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion" Margin="0,-22,0,0" >

现在我的应用程序看起来像这样(在-22保证金):

Now my application looks like this(with the -22 margin) :

现在,它看起来像一个不正常的应用程序一个丑陋的Windows 98或2000的风格和关闭按钮,minizime按钮,最大化按钮回来了!

Now it looks like a normal application without an ugly windows 98 or 2000 style and the close button, minizime button and maximize button are back!

这篇关于WPF窗口边框怪怪的与色带控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆