Click or drag to resize

IVIZZARDServiceGetRibbonControl Method

DevExpress.XtraBars.Ribbon.RibbonControl

Namespace:  SHConnector
Assembly:  SHConnector (in SHConnector.dll) Version: 4.0.0.24207 (4.0.0.24207)
Syntax
C#
Object GetRibbonControl()

Return Value

Type: Object
Ribbon control object
Examples
C#
using SHConnector;

using DevExpress.Data;
using DevExpress.Utils;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;

namespace PluginApiTest
{
    public partial class PluginApi : UserControl, IEntryConnector
    {
        private IVIZZARDService Connector;

        public PluginApi()
        {
            InitializeComponent();
        }

        public PluginApi(IVIZZARDService conn) : this()
        {
            Connector = conn;

            object ribbonMenu = Connector.GetRibbonControl();
            object dockingManager = Connector.GetDockManager();

            DevExpress.XtraBars.Ribbon.RibbonControl RibbonMenu = (DevExpress.XtraBars.Ribbon.RibbonControl)ribbonMenu;
            DevExpress.XtraBars.Docking.DockManager DockingManager = (DevExpress.XtraBars.Docking.DockManager)dockingManager;


            DevExpress.XtraBars.Ribbon.RibbonPage page = new DevExpress.XtraBars.Ribbon.RibbonPage();
            page.Text = "User Menu";
            RibbonMenu.Pages.Add(page);

            DevExpress.XtraBars.Ribbon.RibbonPageGroup group1 = new DevExpress.XtraBars.Ribbon.RibbonPageGroup();
            group1.Text = "User Menu Group 1";
            page.Groups.Add(group1);

            DevExpress.XtraBars.BarButtonItem button1 = new DevExpress.XtraBars.BarButtonItem();
            button1.Caption = "User Button 1";
            group1.ItemLinks.Add(button1);
            button1.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(button1_ItemClick);

            DevExpress.XtraBars.Docking.DockPanel panel = DockingManager.AddPanel(DevExpress.XtraBars.Docking.DockingStyle.Float);
            panel.Text = "Test Panel";

            System.Windows.Forms.UserControl ctrl = new System.Windows.Forms.UserControl();
            ctrl.Dock = System.Windows.Forms.DockStyle.Fill;
            panel.ControlContainer.Controls.Add(ctrl);
        }

        void button1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            MessageBox.Show("[User Button 1] Clicked");
        }
    }
}
See Also