Completed
Last Updated: 15 Aug 2017 11:03 by Danilo
ADMIN
Hristo
Created on: 20 Jun 2017 09:45
Category: RibbonBar
Type: Bug Report
1
FIX. RadRibbonBar - improve the performance when resizing a ribbon form with many RadRibbonBarGroups
How to reproduce: just create a ribbon form with many collapsed ribbon bar groups, e.g. 20 and try to resize the form:

Workaround: change all RadRibbonBarGrpoup instances with the custom class below
public class MyRadRibbonBarGroup : RadRibbonBarGroup
{
    override public bool ExpandElementToStep(int collapseStep)
    {
        bool result = false;
        if (!this.CanCollapseOrExpandElement(ChunkVisibilityState.Expanded))
        {
            return result;
        }

        this.InvalidateIfNeeded();

        if (this.CollapseStep == (int)ChunkVisibilityState.Collapsed)
        {
            this.ExpandChunkFromDropDown();
            --this.CollapseStep;
            result = true;
            this.CollapseCollection((int)ChunkVisibilityState.NoText);
        }
        else
        {
            result = this.ExpandCollection(collapseStep);
        }

        return result;
    }

    private void ExpandChunkFromDropDown()
    {
        this.DropDownElement.Visibility = ElementVisibility.Collapsed;
        this.DropDownElement.Items.Clear();

        ElementWithCaptionLayoutPanel el = (ElementWithCaptionLayoutPanel)typeof(RadRibbonBarGroup).GetField("elementWithCaptionLayoutPanel", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);

        this.Children.Add(el);
    }

    private bool CanCollapseOrExpandElement(ChunkVisibilityState state)
    {
        if (this.IsDesignMode)
        {
            return false;
        }

        return true;
    }
}

1 comment
Danilo
Posted on: 20 Jun 2017 10:46
Thank you so much.
The workaround you provided works fine.
I'll maintain it up to your next deploy for which I'll waiting for.

Best regards