Problem when trying to delete ContextualTabGroups

Jul 20, 2012 at 7:05 AM

Hi,

 

I try to delete Groups but I have an exception when a ContextualTabGroup has more than one RibbonTabItem. I use the following code :

 

            IEnumerable<RibbonContextualTabGroup> DeletedGroups = new List<RibbonContextualTabGroup>(this.Ribbon.ContextualGroups);
            foreach (RibbonContextualTabGroup Group in DeletedGroups)
            {
                foreach (RibbonTabItem Item in Group.Items)
                {
                    if (Item.DataContext != null)
                        ((ViewModelBase)Item.DataContext).OnUnload();
                    this.Ribbon.Tabs.Remove(Item);
                }
                Group.Items.Clear();
            }
            this.Ribbon.ContextualGroups.Clear();

Can you tell me how can I do ?

 

Thanks in advance.

NeoKript

Jul 24, 2012 at 10:05 PM

Hi, 

why do you want to delete them? I never use this option. Usually you set the visibility to collapsed to hide the contextual Tabs. Cause in 90% of your cases (or the users) you gonna reuse these Tabs. And "redrawing" costs a lot more time than just change the visibility.

regards

Igor

Jul 25, 2012 at 6:06 AM

Hi, I do thaht because I've a lot of Contextual tabs group.

This issue can be fixed with this line :

RibbonTitleBar.cs (line 217) :

if ((visibleGroups.Count == 0) || (visibleGroups[0].Items[0].Parent != null && (visibleGroups[0].Items[0].Parent as RibbonTabControl).CanScroll))

NeoKript

Developer
Nov 3, 2012 at 7:39 PM

This issue is fixed in the current source version.