这对你来说可能是个老消息,但是没有一个选定的答案,所以现在开始:
http://msdn.microsoft.com/en-us/library/ff799534.aspx
可以下载源、示例和程序集以包含功能区。文档可在msdn上找到,网址为http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribood.aspx“rel=”nofollow noreferrer“>http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribood.aspx.>
包含RibbonControlsLibrary.dll 4.0版本的项目的简单示例
<window x:class=“wpfribbonApplication1.mainWindow”
xmlns=“http://schemas.microsoft.com/winfx/2006/xaml/presentation”(http://schemas.microsoft.com/winfx/2006/xaml/presentation)
xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:bribbon=“clr名称空间:microsoft.windows.controls.bribbon;assembly=bribbonControlsLibrary”
title=“主窗口”
x:name=“RibbonWindow”
width=“640”height=“480”>
<grid x:name=“layoutRoot”>
<grid.rowdefinitions>
<rowdefinition height=“自动”/>
<rowdefinition height=“*”/>
</grid.rowdefinitions>
<功能区:功能区x:name=“Ribbon”title=“功能区标题”>
<功能区:功能区。帮助窗格内容>
<Ribbon:RibbonButton SmallImageSource=“icon.ico”/>
</Ribbon:Ribbon.HelpPaneContent>
<功能区:功能区。快速访问工具栏>
<功能区:RibbonQuickAccessToolbar>
<Ribbon:RibbonButton x:name=“QatButton1”
smallImageSource=“icon.ico”/>
<Ribbon:RibbonButton x:name=“QatButton2”
smallImageSource=“icon.ico”/>
</Ribbon:RibbonQuickAccessToolbar>
</Ribbon:Ribbon.QuickAccessToolbar>
<功能区:功能区。应用程序菜单>
<Ribbon:RibbonApplicationMenu SmallImageSource=“icon.ico”>
<Ribbon:RibbonApplicationMenuitem header=“你好,Ribbon”
x:name=“菜单项1”
imagesource=“icon.ico”/>
</Ribbon:RibbonApplication菜单>
</Ribbon:Ribbon.ApplicationMenu>
<Ribbon:Ribbontab x:name=“主页选项卡”
header=“主页”>
<Ribbon:RibbonGroup X:name=“Group1”
header=“group1”>
<Ribbon:RibbonButton x:name=“Button1”
largeImageSource=“icon.ico”
label=“按钮1”/>
<Ribbon:RibbonButton x:name=“Button2”
smallImageSource=“icon.ico”
label=“按钮2”/>
<Ribbon:RibbonButton X:name=“Button3”
smallImageSource=“icon.ico”
label=“按钮3”/>
<Ribbon:RibbonButton x:name=“Button4”
smallImageSource=“icon.ico”
label=“按钮4”/>
</Ribbon:RibbonGroup>
</Ribbon:RibbonTab>
</Ribbon:Ribbon>
和/格栅& GT;
&窗/窗;
< /代码>
生成如下内容:
转向,现在开始:
http://msdn.microsoft.com/en-us/library/ff799534.aspx
可以下载源、示例和程序集以包含功能区。该文档可在msdn上找到,网址为http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.aspx.
包含RibbonControlsLibrary.dll 4.0版本的项目的简单示例
<Window x:Class="WpfRibbonApplication1.MainWindow"
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"
Title="MainWindow"
x:Name="RibbonWindow"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ribbon:Ribbon x:Name="Ribbon" Title="Ribbon Title">
<ribbon:Ribbon.HelpPaneContent>
<ribbon:RibbonButton SmallImageSource="Icon.ico" />
</ribbon:Ribbon.HelpPaneContent>
<ribbon:Ribbon.QuickAccessToolBar>
<ribbon:RibbonQuickAccessToolBar >
<ribbon:RibbonButton x:Name="QATButton1"
SmallImageSource="Icon.ico" />
<ribbon:RibbonButton x:Name="QATButton2"
SmallImageSource="Icon.ico" />
</ribbon:RibbonQuickAccessToolBar>
</ribbon:Ribbon.QuickAccessToolBar>
<ribbon:Ribbon.ApplicationMenu>
<ribbon:RibbonApplicationMenu SmallImageSource="Icon.ico">
<ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"
x:Name="MenuItem1"
ImageSource="Icon.ico"/>
</ribbon:RibbonApplicationMenu>
</ribbon:Ribbon.ApplicationMenu>
<ribbon:RibbonTab x:Name="HomeTab"
Header="Home">
<ribbon:RibbonGroup x:Name="Group1"
Header="Group1">
<ribbon:RibbonButton x:Name="Button1"
LargeImageSource="Icon.ico"
Label="Button1" />
<ribbon:RibbonButton x:Name="Button2"
SmallImageSource="Icon.ico"
Label="Button2" />
<ribbon:RibbonButton x:Name="Button3"
SmallImageSource="Icon.ico"
Label="Button3" />
<ribbon:RibbonButton x:Name="Button4"
SmallImageSource="Icon.ico"
Label="Button4" />
</ribbon:RibbonGroup>
</ribbon:RibbonTab>
</ribbon:Ribbon>
</Grid>
</Window>
生成如下内容: