[英]WPF window border acting weird with Ribbon Control
I am using the Ribbon control in WPF and I noticed there are 2 different versions. 我在WPF中使用Ribbon控件,我注意到有2个不同的版本。
using Microsoft.Windows.Controls.Ribbon; 使用Microsoft.Windows.Controls.Ribbon;
using System.Windows.Controls.Ribbon; 使用System.Windows.Controls.Ribbon;
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>
My Ribbontabs will load but the window now looks like this: I can't click on close and minimize and maximize. 我的Ribbontabs将加载但窗口现在看起来像这样:我无法点击关闭并最小化和最大化。 <---
<---
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! 我发现了让它看起来和工作都很好的最佳方法!
Instead of the tags <ribbon:RibbonWindow
on the beginning of the xaml, Make it <Window
. 而不是xaml开头的标签
<ribbon:RibbonWindow
,将其设为<Window
。
Also add this part: 还添加此部分:
xmlns:r="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon"
Then in your class delete your : RibbonWindow
(If it's there) 然后在你的班级删除你的
: RibbonWindow
(如果它在那里)
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 : 如果这不起作用并且您不需要快速访问工具栏,这可能会有所帮助:返回到您的XAML,并将功能区边距更改为-22:
<r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion" Margin="0,-22,0,0" >
Now my application looks like this(with the -22 margin) : 现在我的应用程序看起来像这样(带-22边距):
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! 现在它看起来像一个普通的应用程序没有丑陋的Windows 98或2000风格和关闭按钮,迷你按钮和最大化按钮回来了!
我个人会,或者利用边缘,或者更好,调查那个功能区的风格,并改变它的方式来帮助我的需要
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.