How to disable click of RibbonTab in WinForms using C#

2 posts, 1 answers
  1. Abins
    Abins avatar
    8 posts
    Member since:
    Dec 2018

    Posted 28 Dec 2018 Link to this post

    I am using RadRibbonBar which have several Tabs. For one tab, instead of displaying the my group, I need to attach a action to execute. Currently, when I click on any tab, the highlighted area will be visible. But for the particular settings tab, I don't need to tdisplay this area. But I need to attach an action.

     

    Thanks in advance.

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3466 posts

    Posted 31 Dec 2018 Link to this post

    Hello, Abins, 

    You can prevent the current tab from being changed but also detect when a specific tab is clicked. For this purpose you can handle the RadRibbonBar.CommandTabSelecting and cancel it when the clicked tab is the desired one Then, execute the desired logic. 

    public RadForm1()
    {
        InitializeComponent();
     
        this.radRibbonBar1.CommandTabSelecting+=radRibbonBar1_CommandTabSelecting;
    }
     
    private void radRibbonBar1_CommandTabSelecting(object sender, Telerik.WinControls.UI.CommandTabSelectingEventArgs args)
    {
        if (args.NewCommandTab== this.ribbonTab2)
        {
            args.Cancel = true;
            RadMessageBox.Show("Tab2 is clicked");
        }
    }

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top