Fluent Ribbon Control Suite Walkthrough

August 28, 2017 | Author: vanbengkulen | Category: License, Software, System Software, Intellectual Works
Share Embed Donate


Short Description

Download Fluent Ribbon Control Suite Walkthrough...

Description

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

Overview Fluent Ribbon Control Suite is a library that implements Microsoft® Office Fluent™ user interface for the Windows Presentation Foundation (WPF). This document covers the main features of this framework and highlights how to use it. It is a good document to make fast inside in ribbon development. To get more practice you can download samples from http://fluent.codeplex.com Any portion of this document can be reprinted without restrictions except the reference to original is required.

Fluent Ribbon Control Suite and this document are distributed under Microsoft Permissive License (Ms-PL). This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. 1. Definitions The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the same meaning here as under U.S. copyright law. A “contribution” is the original software, or any additions or changes to the software. A “contributor” is any person that distributes its contribution under this license. “Licensed patents” are a contributor’s patent claims that read directly on its contribution. 2. Grant of Rights (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a nonexclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a nonexclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. 3. Conditions and Limitations (A) No Trademark License- This license does not grant you rights to use any contributors’ name, logo, or trademarks. (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. (E) The software is licensed “as-is.” You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

Foundation Let‘s learn how to create a simple window with basic elements, such as RibbonTabItem, RibbonGroupBox, Quick Access Toolbar and so on.

As you can see, the window above is not usual WPF window: it has aero style and some elements located in the title bar area. To achieve this you need use Fluent.RibbonWindow. RibbonWindow is designed to provide proper office-like glass style. RibbonWindow automatically will use special nonDWM style in case of Windows XP or basic Windows 7/Vista theme (see below).

One of the way to create RibbonWindow is to create regular WPF window and change System.Windows.Window to Fluent.RibbonWindow in code and XAML. You can still use regular System.Windows.Window as you need. Your code and XAML will something like this:

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

/// /// Represents the main window of the application /// public partial class Window : RibbonWindow { /// /// Default constructor /// public Window() { InitializeComponent(); } }

BEAWARE: You need also add one of themes in App.xaml, for example:

Let’s add Ribbon in the Window

The code above produces the ribbon with single tab, group and two buttons. Quick Access Toolbar is a toolbar with shortcuted controls. You can add any Fluent-based control using context menu (a control has to implement IQuickAccessToolbarItem interface). You can also pin controls to Quick Access Toolbar menu.

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

You can add pinned Quick Access Items named QuickAccessMenuItem to collection Ribbon.QuickAccessItems. To associate target element you may bind it to QuickAccessMenuItem.Target property or just set the content.

The button “File” in left-top corner opens empty backstage, let’s fill Backstage with items:

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

The last step is to add contextual tab. Contextual tab is visible when a particular object in an app selected. Contextual tabs cannot exist out of contextual tab group, so we need to create contextual tab group (RibbonContextualTabGroup) and bind a tab to this group. RibbonContextualTabGroup need to be added to Ribbon.ContextualGroups collection:

And associate a tab to this group:

RibbonContextualTabGroup is not visible by default. To show or hide contextual tab you must set RibbonContextualTabGroup.Visibility property to Visible or Collapsed.

© Degtyarev Daniel, Rikker Serg 2009-2010. All rights reserved http://fluent.codeplex.com

Resizing All RibbonGroupBox can be in four states: Large->Middle->Small->Collapsed. By default RibbonGroupBox’s are in Large state. When a RibbonGroupBox changes its state it changes size of all its controls. RibbonTabItem has ReduceOrder property. This property defines order of group to reduce. You can enumerate group names from the last to first to reduce. All ribbon contols (Buttons, DropDownButtons, Spinners and so on) have SizeDefinition property. You can define which size will be used when the group will be in the particular state. For example, if you set SizeDefinition = "Middle, Middle, Small", that means: Large State of the group -> Middle size of the control Middle State of the group -> Middle size of the control Small State of the group -> Small size of the control
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF