Skip to main content

Simon Matthews

Go Search
Infusion Blogs - Beta
  

 MSFT Cert's

Microsoft Certified Professional Developer
Microsoft Certified Technology Specialist
Microsoft Certified Solution Developer
Microsoft Certified Application Developer

 Linkedin

View Simon Matthews's profile on LinkedIn
Infusion Blogs - Beta > Simon Matthews
Updated Ribbon on Silverlight Streaming

Just a quick post to point out that I have updated the demo site for the Ribbon control to Silverlight version 2. The demo can still be accessed at http://silverlight.services.live.com/invoke/60108/SilverlightRibbon/iframe.html

Silverlight Ribbon Interview

I've had some really great feedback from people since publishing the Ribbon control to CodePlex. I was even invited to answer some questions by Michael Scherotter who was, as far as I can tell, the first guy to experiment with a Silverlight based Ribbon! I remember playing with and reading all I could about his efforts back before I started my version. Michael was kind enough to publish my responses on his blog...

http://blogs.msdn.com/synergist/archive/2008/12/02/an-interview-with-the-developer-of-a-silverlight-2-ribbon-interface.aspx

Silverlight Ribbon on CodePlex

I've been too busy to put much effort into finishing my Ribbon control, but as it is workable in its current state I have published the code on CodePlex. I hope to spend more time updating the Ribbon soon, but it may not get a great deal of attention until the new year.

I hope the current code is good enough to be used, if there are bugs, issues, suggestions, etc. I love for people to add them to the CodePlex project site and if there are questions/comments please feel free to email me or comment on my blog / CodePlex site.

I'd like to thank all those patient people who supported me and waited for this to be put up. Anyway, enjoy!

Silverlight Ribbon - RC0

Further to my post this morning I have rectified all issues with the layout of the Ribbon, it was a simple matter of perfecting my logic with the small changes required by the RC0 update.

It's nice to see the pixel rounding in action. Pixel blurring was a real issue for the Ribbon control. Single pixel lines were the hardest problem to solve in the Beta versions - I resolved the issues I had using clipping and small shifts of 0.5 pixels etc. This new rounding will leave some of the code defunct - I think I'll probably get round to removing the extraneous code when I introduce Visual States into the control (yes, this control was started before the VisualStateManager was part of the framework!).

Another small change, that is immediately noticeable, is the font rendering. The Ribbon control has to use fairly small font sizes for the buttons / labels / etc. and these seem to render more clearly - but also a little bigger... something else to add to my to-do list to investigate!

RC0 Ribbon Issues

I've been so busy recently I've not had time to work on my Ribbon control. Yesterday I upgraded, with only some minor tweaks, to RC0. Unfortunately the changes in RC0 have broken the layout of the control... I will be working on getting it back to the state it was in before then move to RC0. I intend to put some more time into enhancing the functionality and fixing the few bugs the current code base has in the near future. Hopefully I can get around to explaining the rest of the control set as well!

Silverlight RC0 HitTest
I was upgrading my Ribbon control to RC0 and came across an issue with HitTest. It seems the method has been removed from the Control class.
 
I found an alternate approach at http://silverlight.net/forums/t/30209.aspx.
 
Basically you have to replace any HitTest method calls with VisualTreeHelper.FindElementsInHostCoordinates (make sure System.Windows.Media is included).
Silverlight Control Uri Property

Until recently I had been creating Uri properties on my Silverlight controls as strings and then creating a new Uri object when the string was updated. I've since come to learn of the UriTypeConverter...  simply decorating your Uri property with a TypeConverter attribute the runtime will deal with any conversion for you.

   1: using System.ComponentModel;
   2:  
   3: public class SilverlightControl : Control
   4: {
   5:     [TypeConverter(typeof(UriTypeConverter))]
   6:     public Uri MyUri
   7:     {
   8:         get; set;
   9:     }
  10: }
Ribbon Controls - Part 1

The controls I’ve built attempt to replicate the exact functionality of those used in Microsoft Office 2007. The Ribbon is quickly becoming a familiar cross application user interface, mimicking the Ribbon’s functionality allows for a seamless transition from Office to applications that make use of this control.

 

Controls currently under construction are as follows; (I’ll describe the first two items below in this post and the rest in later posts...)

 

1.       Ribbon / RibbonTab / RibbonTabGroup

2.       RibbonButton

3.       RibbonButtonGroup / RibbonButtonGroupButton

4.       RibbonLabel

5.       RibbonSeparator

6.       RibbonToolTip

7.       RibbonMainMenu /RibbonMainMenuPinableItem

8.       Menu / MenuItem / MenuSeparator

9.       DropDownList

10.   NumericUpDown

11.   CheckBox

12.   Document / DocumentPage

 

1. Ribbon / Ribbon Tab / RibbonTabGroup

 

The main Ribbon control features a large button known as the ‘OfficeButton’ in the top left which can be given an image via the OfficeButtonImageSource property.

 

The control can have multiple tabs (RibbonTab objects - figure 1) which in turn can have multiple tab groups (RibbonTabGroup objects - figure 2).

 

Figure 1 - Tabs

 

Figure 2 - Tab Group

 

A tab group can have a two or three row layout (Rows property). As controls are added to the tab group they are automatically positioned. For example, a large button will take up two or three rows regardless of the tab group row setting, whilst a small button will take up one row. If there is not enough space for a control to be added in the current column the tab group will expand to another column.

 

Both RibbonTab and RibbonTabGroup objects have a Title property which controls the text displayed on the tab or tab group respectively.

 

RibbonTabGroup objects have a Dialog property (Hidden [default] | Enabled | Disabled) which controls the appearance of the dialog button in the bottom right hand corner of the tab group.

 

RibbonTab objects are the default content for the Ribbon control, other properties that may have content are; QuickLaunchButtons, Menus and ToolTips.

 

The quick launch tool bar sits to the right of the OfficeButton; this will take RibbonButton objects as children (ignoring the Format property as these must be small buttons).

 

Example XAML

<rbn:Ribbon x:Name="RibbonCtrl" OfficeButtonImageSource="Images/OfficeLogo.png">

    <rbn:Ribbon.QuickLaunchButtons>
        <rbn:RibbonButton SmallImageSource="Images/Save.png" />
        <rbn:RibbonButton SmallImageSource="Images/Undo.png" />
    </rbn:Ribbon.QuickLaunchButtons>

    <rbn:RibbonTab Title="Home">
        <rbn:RibbonTabGroup Title="Clipboard" Dialog="Enabled" />
        <rbn:RibbonTabGroup Title="Font" Rows="Two" Dialog="Enabled" />
        <rbn:RibbonTabGroup Title="Paragraph" Rows="Two" Dialog="Enabled" />
        <rbn:RibbonTabGroup Title="Styles" Dialog="Enabled" />
        <rbn:RibbonTabGroup Title="Editing" />
    </rbn:RibbonTab>
    <rbn:RibbonTab Title="Insert" />
    <rbn:RibbonTab Title="Page Layout" />
    <rbn:RibbonTab Title="References" />
    <rbn:RibbonTab Title="Mailings" />
    <rbn:RibbonTab Title="Review" />
    <rbn:RibbonTab Title="View" />
    
    <rbn:Ribbon.ToolTips />
    <rbn:Ribbon.Menus />
    
</rbn:Ribbon>

2. RibbonButton

 

The RibbonButton has different appearances based on its Format property (Large [default] | SmallWithText | Small). It also has two image source properties that are used with the appropriate Format, these are LargeImageSource and SmallImageSource.

 

The RibbonButton has a MenuID property which can be the name of a menu in the parent Ribbon control’s MenuCollection (also accessible via the Menus property). The button also has a Click event which can be subscribed to.

 

RibbonButton controls have a read-only ButtonMenuStyle property that describes the buttons menu behaviour (None [default] | Simple | Split). The style is derived in the following way;

 

MenuID

Click Event Handler

ButtonMenuStyle

n/a

n/a

None

n/a

<event handler>

None

<menu id>

n/a

Simple

<menu id>

<event handler>

Split

 

Depending on the ButtonMenuStyle and Format the button will be rendered as a default button, a simple menu button or a split menu button in either large or small. Examples of each style can be seen in figures 3 and 4 below.

 

Figure 3 - Large Buttons

 

Figure 4 - Small Buttons 

 

RibbonButton objects also have a ToolTipID property which can be the name of a tooltip in the parent Ribbon control’s ToolTipCollection (also accessible via the ToolTips property).

 

Example XAML

<rbn:RibbonTabGroup Title="Editing">
    <rbn:RibbonButton Format="SmallWithText" Text="Find"
                      SmallImageSource="Images/Find.png" MenuID="MenuFind"
                      ButtonClick="RibbonButton_ButtonClick" />
    <rbn:RibbonButton Format="SmallWithText" Text="Replace"
                      SmallImageSource="Images/Replace.png" />
    <rbn:RibbonButton Format="SmallWithText" Text="Select"
                      SmallImageSource="Images/Select.png" MenuID="MenuSelect" />
</rbn:RibbonTabGroup>

 

Until next time...

 

 

Silverlight Ribbon
 
 
Over the past couple of months I've been working on some re-usable controls centred around the Office Fluent Ribbon for Silverlight.
 
I have decided to host an example application 'Silverlight Ribbon' at Silverlight Streaming to show off the controls' features. I'll be making updates on a frequent basis and any changes I make I'll blog about here.
 
I'll also blog about the current feature set and my massive to-do list in the near future...
 
Another aim of this blog is to highlight interesting things I've found during development of the control, tips and tricks I've learnt along the way and pitfalls I've fallen into - so watch this space :)
 
-------
 
Note: Silverlight Streaming seems to be doing something strange with the images used in the application. Sometimes they're not loaded at all, and sometimes only a partial set is loaded. I'll be looking into this as a priority.
 
Fixed the issue by adding the images to the XAP as a resource.
 
 

 The Blogger in Question

 Xbox Live GamerCard

 ‭(Hidden)‬ Admin Links

 MSFT Office User Interface License

Microsoft Office User Interface.  These license terms grant you no rights to make, copy, use or distribute any elements of the Microsoft Office user interface such as the ribbon and quick access toolbar (the Office user interface is formally known as the Microsoft Office Fluent user interface), the license terms for which are available separately.  To learn more about the Office user interface licensing program, please visit http://msdn.microsoft.com/officeui.