我正在使用Microsoft功能区控件。 我需要合并功能区标题栏和窗口标题栏,但我得到非常糟糕的结果,如下图所示。我还需要的是图片。
请为我提供解决方案:
谢谢
xaml中的代码如下:
<ribbon:RibbonWindow
x:Uid="RibbonWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking" x:Class="WpfRibbonApplication1.MainWindow"
Title="MainWindow"
x:Name="RibbonWindow"
Width="640" Height="480">
<Grid x:Uid="LayoutRoot" x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition x:Uid="RowDefinition_1" Height="Auto"/>
<RowDefinition x:Uid="RowDefinition_2" Height="*"/>
</Grid.RowDefinitions>
<ribbon:Ribbon x:Uid="Ribbon" x:Name="Ribbon" Title="Ribbon Title">
<ribbon:Ribbon.HelpPaneContent>
<ribbon:RibbonButton x:Uid="ribbon:RibbonButton_1" Content="1" />
</ribbon:Ribbon.HelpPaneContent>
<ribbon:Ribbon.QuickAccessToolBar>
<ribbon:RibbonQuickAccessToolBar x:Uid="ribbon:RibbonQuickAccessToolBar_1" >
<ribbon:RibbonButton x:Uid="QATButton1" x:Name="QATButton1"
Content="2" />
<ribbon:RibbonButton x:Uid="QATButton2" x:Name="QATButton2"
Content="3" />
</ribbon:RibbonQuickAccessToolBar>
</ribbon:Ribbon.QuickAccessToolBar>
<ribbon:Ribbon.ApplicationMenu>
<ribbon:RibbonApplicationMenu x:Uid="ribbon:RibbonApplicationMenu_1">
<ribbon:RibbonApplicationMenuItem x:Uid="MenuItem1" Header="Hello _Ribbon"
x:Name="MenuItem1"
/>
</ribbon:RibbonApplicationMenu>
</ribbon:Ribbon.ApplicationMenu>
<ribbon:RibbonTab x:Uid="HomeTab" x:Name="HomeTab"
Header="Home">
</ribbon:RibbonTab>
</ribbon:Ribbon>
</Grid>
答案 0 :(得分:0)
显示标题栏中的快速访问工具栏项
显示您需要导入项目中图标的项目。之后你需要引用RibbonButton中的图标,我在这里使用 SmallImageSource 属性。
<ribbon:Ribbon.QuickAccessToolBar>
<ribbon:RibbonQuickAccessToolBar x:Uid="ribbon:RibbonQuickAccessToolBar_1" >
<ribbon:RibbonButton x:Uid="QATButton1" x:Name="QATButton1"
Content="2" SmallImageSource="Images/YourIcon_1.png" />
<ribbon:RibbonButton x:Uid="QATButton2" x:Name="QATButton2"
Content="3" SmallImageSource="Images/YourIcon_2.png" />
</ribbon:RibbonQuickAccessToolBar>
</ribbon:Ribbon.QuickAccessToolBar>