Back to Devexpress

DashboardDesignerBarExtensions.GetDashboardRibbonPage(RibbonControl, DashboardBarItemCategory, DashboardRibbonPage) Method

dashboard-devexpress-dot-dashboardwin-dot-dashboarddesignerbarextensions-dot-getdashboardribbonpage-x28-ribboncontrol-dashboardbaritemcategory-dashboardribbonpage-x29.md

latest5.3 KB
Original Source

DashboardDesignerBarExtensions.GetDashboardRibbonPage(RibbonControl, DashboardBarItemCategory, DashboardRibbonPage) Method

Returns a page from the Ribbon toolbar used in the Dashboard Designer.

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public static RibbonPage GetDashboardRibbonPage(
    this RibbonControl ribbonControl,
    DashboardBarItemCategory itemCategory,
    DashboardRibbonPage page
)
vb
<ExtensionAttribute>
Public Shared Function GetDashboardRibbonPage(
    ribbonControl As RibbonControl,
    itemCategory As DashboardBarItemCategory,
    page As DashboardRibbonPage
) As RibbonPage

Parameters

NameTypeDescription
ribbonControlRibbonControl

A Ribbon toolbar used in the Dashboard Designer.

| | itemCategory | DashboardBarItemCategory |

A Ribbon page category that contains commands related to a particular dashboard item.

| | page | DashboardRibbonPage |

A Ribbon page.

|

Returns

TypeDescription
RibbonPage

A Ribbon page that meets the specified parameters.

|

Remarks

Use the GetDashboardRibbonPage method to identify a Ribbon page.

For example, you can add new control elements to the current Ribbon instance. The following code snippet shows how to add the Dashboard Description button to the Dashboard group on the Dashboard’s Home page:

csharp
using DevExpress.DashboardWin;
using DevExpress.DashboardWin.Localization;
using DevExpress.Utils.Svg;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon; 

namespace WimForms_Dashboard {
    public partial class Form1 : RibbonForm {
        public Form1(){
            InitializeComponent();
            dashboardDesigner1.CreateRibbon();
            RibbonControl ribbon = dashboardDesigner1.Ribbon;
            RibbonPage page = ribbon.GetDashboardRibbonPage(DashboardBarItemCategory.None, DashboardRibbonPage.Home);
            RibbonPageGroup group = page.Groups.GetGroupByText(DashboardWinLocalizer.GetString(DashboardWinStringId.RibbonPageDashboardCaption));
            BarButtonItem barItem = CreateBarItem("Dashboard Description", svgImageCollection1["barImage"]);
            group.ItemLinks.Add(barItem);
        }
        BarButtonItem CreateBarItem(string caption, SvgImage barImage){
            BarButtonItem barItem = new BarButtonItem();
            barItem.Caption = caption;
            barItem.ImageOptions.SvgImage = barImage;
            return barItem;
        }
    }
}
vb
Imports DevExpress.DashboardWin
Imports DevExpress.DashboardWin.Localization
Imports DevExpress.Utils.Svg
Imports DevExpress.XtraBars
Imports DevExpress.XtraBars.Ribbon

Namespace WimForms_Dashboard
    Partial Public Class Form1
        Inherits RibbonForm

        Public Sub New()
            InitializeComponent()
            dashboardDesigner1.CreateRibbon()
            Dim ribbon As RibbonControl = dashboardDesigner1.Ribbon
            Dim page As RibbonPage = ribbon.GetDashboardRibbonPage(DashboardBarItemCategory.None, DashboardRibbonPage.Home)
            Dim group As RibbonPageGroup = page.Groups.GetGroupByText(DashboardWinLocalizer.GetString(DashboardWinStringId.RibbonPageDashboardCaption))
            Dim barItem As BarButtonItem = CreateBarItem("Dashboard Description", svgImageCollection1("barImage"))
            group.ItemLinks.Add(barItem)
        End Sub
        Private Function CreateBarItem(ByVal caption As String, ByVal barImage As SvgImage) As BarButtonItem
            Dim barItem As New BarButtonItem()
            barItem.Caption = caption
            barItem.ImageOptions.SvgImage = barImage
            Return barItem
        End Function
    End Class
End Namespace

See Also

Ribbon

DashboardDesignerBarExtensions Class

DashboardDesignerBarExtensions Members

DevExpress.DashboardWin Namespace