This is a migrated thread and some comments may be shown as answers.

Keep selected appearance when collapsed

1 Answer 71 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 24 Jul 2019, 01:24 AM

Is there a way to keep the ribbonbar tab selected when the ribbon is collapsed?  I am want to achieve the pageview's tabbing and page switching features along with the ribbonbar's ribbon formatting.  If collapsed, the ribbonbar doesn't appear to have a SelectedCommandTab value present.  I need to keep this property and the appearance of a selected tab when the ribbon bar is collapsed.

Is this possible, or is there a better solution?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jul 2019, 10:39 AM
Hello, Mark,   

If I understand your requirement correctly, you need to have indication which tab is selected when RadRibbonBar is collapsed. However, by default, after collapsing RadRibbonBar, the SelectedCommandTab is reset to null.

The possible solution that I can suggest is to store which is the selected tab and when you collapse RadRibbonBar restore the selection as it is demonstrated in the below code snippet:

public RadForm1()
 {
     InitializeComponent();
     this.ribbon.CommandTabSelected += richTextEditorRibbonBar1_CommandTabSelected;
     this.ribbon.ExpandedStateChanged += richTextEditorRibbonBar1_ExpandedStateChanged;
     lastSelected = this.ribbon.SelectedCommandTab;
 }
 
 RibbonTab lastSelected;
 
 private void richTextEditorRibbonBar1_CommandTabSelected(object sender, CommandTabEventArgs args)
 {
     lastSelected = args.CommandTab;
 }
 
 private void richTextEditorRibbonBar1_ExpandedStateChanged(object sender, EventArgs e)
 {
     if (this.ribbon.Expanded == false)
     {
         lastSelected.IsSelected = true;
     }
 }

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.
Tags
RibbonBar
Asked by
Mark
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or