Completed
Last Updated: 05 Nov 2014 12:49 by ADMIN
ADMIN
George
Created on: 21 Oct 2014 14:41
Category:
Type: Bug Report
1
FIX. RadCollapsiblePanel - Anchoring controls makes them resize after the form is started
To reproduce:

Add a RadCollapsiblePanel and a few controls inside, such as 1-2 buttons and a RadRichTextBox. Align their Y and Width. Anchor them to Top, Left, Right. When you start the form you will see that their width will increase.

You can also try with the attached project

Workaround:

Create the following custom RadCollapsiblePanel and use it instead:

public class MyCollapsiblePanel : RadCollapsiblePanel
{
    private MyCollapsiblePanelControlsContainer panelContainer;

    public new CollapsiblePanelPanelContainer PanelContainer
    {
        get
        {
            return this.panelContainer.PanelContainer;
        }
    }

    protected override CollapsiblePanelControlsContainer CreateControlsContainer()
    {
        this.panelContainer = new MyCollapsiblePanelControlsContainer();
        return this.panelContainer;
    }

    public override string ThemeClassName
    {
        get
        {
            return typeof(RadCollapsiblePanel).FullName;
        }
        set
        {
        }
    }
}

public class MyCollapsiblePanelControlsContainer : CollapsiblePanelControlsContainer
{
    public new CollapsiblePanelPanelContainer PanelContainer { get; set; }

    protected override RadScrollablePanelContainer CreateScrollablePanelContainer()
    {
        this.PanelContainer = new CollapsiblePanelPanelContainer(this);
        return this.PanelContainer;
    }
}

public class CollapsiblePanelPanelContainer : RadScrollablePanelContainer
{
    public CollapsiblePanelPanelContainer(RadScrollablePanel parentPanel)
        : base(parentPanel)
    {
    }

    public new Size Size
    {
        get
        {
            return base.Size;
        }
        set
        {
            base.Size = value;
            RadCollapsiblePanel cp = this.FindCollapsiblePanelParent();
            if (cp != null && cp.IsInitializing)
            {
                cp.ControlsContainer.Size = value;
            }
        }
    }

    protected virtual RadCollapsiblePanel FindCollapsiblePanelParent()
    {
        Control parent = this.Parent;
        do
        {
            if (parent is RadCollapsiblePanel)
            {
                return parent as RadCollapsiblePanel;
            }

            parent = parent.Parent;
        } while (parent != null);

        return null;
    }
}
1 comment
ADMIN
Stefan
Posted on: 05 Nov 2014 12:49
We have just issued a new release - Q3 2014 2014.3.1104, which covers this issue and couple more issues important for our customers. For complete list of changes, please refer to our Release Notes (http://www.telerik.com/support/whats-new/winforms/release-history/ui-for-winforms-q3-2014-(version-2014.3.1104)).