Programmatically Select a Ribbon Tab

8 posts, 0 answers
  1. Chris Kirkman
    Chris Kirkman avatar
    37 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2010 Link to this post

    Anyone know how to do this?  I have several ribbon tabs on my ribbon bar control.  I want to automatically set focus to one of the ribbon tabs based on interaction elsewhere in my application.  There doesn't seem to be an obvious method to select one of the ribbon tabs as the currently selected one.
  2. Chris Kirkman
    Chris Kirkman avatar
    37 posts
    Member since:
    Jul 2012

    Posted 19 Jul 2010 Link to this post

    Ok, found it myself.

    RibbonTab.IsSelected = true;

    This applies focus.  This seems a bit unorthodox.  I would have assumed a method such as RibbonTab.Select() be used instead.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 26 Sep 2012 Link to this post

    Thanks ! It works for me.
  5. Gabriel
    Gabriel avatar
    4 posts
    Member since:
    Aug 2013

    Posted 06 Mar 2014 Link to this post

    Worked for me too :)

     

  6. Curtis
    Curtis avatar
    5 posts
    Member since:
    Oct 2014

    Posted 29 Sep 2015 Link to this post

    Not only would i have expected the object to have a method to indicate selection, i'd have expected some type of property or method from the parent as well:

    myRadRibbonTab.Selected()   ' Tell's the parent Ribbon Tab i'm the one selected thus setting the tab

    -or-

    myRadRibbonBar.SelectedTab() = myRadRibbonTab   ' Sets the Tab

  7. Dess
    Admin
    Dess avatar
    1605 posts

    Posted 30 Sep 2015 Link to this post

    Hello Curtis,

    Thank you for writing.

    You can specify which tab is selected by setting the IsSelected property to true for the desired RibbonTab. Alternatively, you can change the selected tab at control level as well by setting the RadRibbonBar.RibbonBarElement.TabStripElement.SelectedItem property:
    this.radRibbonBar1.RibbonBarElement.TabStripElement.SelectedItem = this.ribbonTab4;

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Mahmoud
    Mahmoud avatar
    10 posts
    Member since:
    Mar 2015

    Posted 17 Feb Link to this post

    Hello

    You can use this code 

    this.ribbonTab3.IsSelected = true;
    this.ribbonTab3.Owner.Focus();
    this.radRibbonBar1.Refresh();

     

  9. Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    710 posts

    Posted 17 Feb Link to this post

    Hello Mahmoud,

    Thank you for writing.

    Indeed, this is a valid solution in case you would like to focus on the tab strip, otherwise setting the IsSelected property of the ribbon tab is enough.

    I hope this helps. Please let me know if you need additional information.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready