开发者

Office ribbon for WPF 4.0

It is rumoured that WPF 4.0 would deliver us an out-of-the-box Office Ribbon.

A new WPF Ribbon Control will be available for download shortly after the release of WPF 4. [1]

Now my internet and MSDN search turned out to be fruitless, and as far as I know, it would be release after the .NET 4.0 framework would开发者_运维知识库 launch. My search lead me to the Office plugin ribbon controls and the CTP prereleased before the release of .net 4.0 with a limited featureset.

So my question is: does anyone know if and when Microsoft will release this Office Ribbon with the framework? Or if they don't a nice press note saying that they ditched the project.

Also if anyone has experience with the Ribbon I'm talking about, will this Ribbon work in a partial trusted environment?

My thanks will be ever lasting! ;)


This may be old news to you now but there wasn't a selected answer so here you go:

http://msdn.microsoft.com/en-us/library/ff799534.aspx

You can download the source, examples, and assemblies for including a ribbon. The documentation can be found on MSDN at http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.aspx.

Simple example from a project that includes the 4.0 version of the RibbonControlsLibrary.dll

<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>

Produces something that looks like this:

Office ribbon for WPF 4.0


Have you seen the WPF 3.5 ribbon?


It should work in partial trust unless they make a huge mistake :). Things not allowed in partial trust are:

  • Connecting directly to SQL
  • Reflection
  • a few other things

Shouldn't be doing that sort of thing in a UserControl (even if it is a bit fancy...)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜