How to: Create a Ribbon Tab
To create a custom Ribbon tab, you must implement the following classes:
The classes that you implement to create a Ribbon tab are also used to implement a report designer. For an example, see How to: Create Report Designers.
The examples that follow create a Ribbon tab in PerformancePoint Dashboard Designer.
Implementing ReportViewFactory
The following code example connects your extension to Dashboard Designer.
using System.Drawing;
using System.Windows.Forms;
using CustomPlugin.Properties;
using Microsoft.PerformancePoint.Scorecards.Modeler.Framework;
using Microsoft.PerformancePoint.Scorecards.Modeler.Framework.Utilities;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.ReportViews;
namespace CustomPlugin
{
// Define properties for your custom Ribbon tab.
public class CustomPluginFactory : ReportViewFactory
{
private CustomPluginPanel customPluginPanel = new CustomPluginPanel();
private Image image = Resources.CustomPlugin;
public static readonly string CustomReportName = "CustomPluginReport";
private string displayName = "Custom Plugin Report";
public static string CustomPluginTabId = "CustomPluginTab";
public ToolStripButton Tab;
public CustomPluginFactory()
{
Initialize();
}
public override void Initialize()
{
// Check for the custom Ribbon tab and add it if it does
// not yet exist.
If (MainForm.GetInstance().GetOfficeRibbonPanel(CustomPluginPanel.PanelId) == null)
{
Tab = MainForm.GetInstance().OfficeRibbonTab.AddTabButton("Custom Plugin Tab", CustomPluginTabId, ModelerColors.AlternateText, Keys.X, "X");
Tab.Visible = true;
MainForm.GetInstance().OfficeRibbonTab.OfficeRibbonTabPage.AddOfficeRibbonPanel(customPluginPanel, CustomPluginTabId);
}
}
// Create and return a copy of your custom Ribbon tab.
public override ReportViewEditorControl CreateReportViewEditorControl()
{
return CustomPluginEditorControl.Instance;
}
public override Image Image
{
get { return image; }
}
public override string ReportName
{
get { return CustomReportName; }
}
public override string DisplayName
{
get { return displayName; }
}
}
}
Implementing ReportViewEditorControl
In the previous example, the CustomPluginFactory class references the CustomPluginEditorControl class. In the following code example, CustomPluginEditorControl inherits from the ReportViewEditorControl class and overrides appropriate methods to create a Ribbon tab.
using System;
using System.Windows.Forms;
using Microsoft.PerformancePoint.Scorecards;
using Microsoft.PerformancePoint.Scorecards.Modeler.Framework.Utilities;
using Microsoft.PerformancePoint.Scorecards.ModelerPlugins.ReportViews;
namespace CustomPlugin
{
public partial class CustomPluginEditorControl : ReportViewEditorControl
{
private static CustomPluginEditorControl customPluginEditorControl;
public static CustomPluginEditorControl Instance
{
get { return customPluginEditorControl; }
}
static CustomPluginEditorControl()
{
customPluginEditorControl = new CustomPluginEditorControl();
}
private CustomPluginEditorControl()
{
InitializeComponent();
}
// Override the SetElement method.
// The overriden method is called when the item is selected
// in the Workspace Browser.
public override void SetElement(ReportView reportView, UndoManager undoManager)
{
}
// Override the SetSummaryPanel method.
// The overridden method is called when the item is selected
// in the Workspace Browser.
public override void SetSummaryPanel(ReportViewSummaryTab summary)
{
}
public override Guid ReportViewId
{
get { return Guid.Empty; }
}
public override TextBox WidthTextBox
{
get { return null; }
}
public override TextBox HeightTextBox
{
get { return null; }
}
public override CheckBox AppendPageFiltersCheckBox
{
get { return null; }
}
}
}
See Also
Tasks
How to: Install a Ribbon Extension
Concepts
How to: Create a Report Wizard Template
How to: Create a Ribbon Panel and Button