How does it work?
Ribbon interface was introduced in SharePoint 2010 to help users quickly find commands that they need to complete tasks. It's like Microsoft Office system applications ribbon, all controls are organized in logical tabs and groups.
SharePoint allows developers to customize ribbon elements. There are two ways to do it:
- Custom Actions (by using a feature);
- Data Extensions supported by Microsoft.Web.CommandUI.Ribbon control.
ribbon elements to a page.
On the other hand
method allows to extend SharePoint ribbon programmatically. All you need is only instance of SPRibbon (actually you need instance of a page containig ribbon control):
var ribbon = SPRibbon.GetCurrent(Page);
// Register your data extension
QASPRibbon vs XML
To add custom SharePoint ribbon elements (tab, group, controls, etc.) by using RegisterDataExtension method we need a XML-declaration of used elements and template. QASPRibbon generates it! For example, instead XML declaration of a ribbon button like following:
you've to have only a code definition of it:
var button = new RibbonButton("ButtonId", "ButtonTitle")
Image = Gallery2.GetExternalDataFromText,
OnClientClick = "GetExternalDataFromText()"
What does QASPRibbon do?
QASPRibbon generates ribbon XML (for controls and templates) and client-side code:
Full size image
Using QASPRibbon allows you to focus on solution developing rather than the learning
Server Ribbon schema
Ribbon controls' hierarchy
Adding a custom tab to the SharePoint Rbbon