Completed
Last Updated: 14 Nov 2014 08:41 by ADMIN
ADMIN
George
Created on: 03 Nov 2014 11:49
Category:
Type: Bug Report
1
FIX. RadCollapsiblePanel - Resizing the parent form when the panel is anchored to left right and top and is collapsed does not result in correct size when expanded
To reproduce:

Add a RadCollapsiblePanel to a form and anchor it to top left and right. Start the application, collapse the panel and resize the form to the right. Expand the panel and you will see that the width is incorrect.

Workaround:

Use the following code, call the CollapsbilePanelAnchorFix to recursively find all CollapsiblePanels and subscribe to the event which fixes the issue:

public RadForm1()
{
    InitializeComponent();
    this.CollapsiblePanelAnchorFix(this);
}



public void CollapsiblePanelAnchorFix(Control parent)
{
    foreach (Control ctrl in parent.Controls)
    {
        if (ctrl is RadCollapsiblePanel)
        {
            ctrl.SizeChanged += radCollapsiblePanel1_SizeChanged;
        }        this.CollapsiblePanelAnchorFix(ctrl);
    }

}



void radCollapsiblePanel1_SizeChanged(object sender, EventArgs e)
{
    RadCollapsiblePanel panel = sender as RadCollapsiblePanel;
    if (!panel.IsExpanded)
    {
        if (panel.ExpandDirection == Telerik.WinControls.UI.RadDirection.Up ||
            panel.ExpandDirection == Telerik.WinControls.UI.RadDirection.Down)
        {
            panel.OwnerBoundsCache = 
                new Rectangle(panel.Location, new Size(panel.Bounds.Width, panel.OwnerBoundsCache.Height));
        }
        else
        {
            panel.OwnerBoundsCache =
                new Rectangle(panel.Location, new Size(panel.OwnerBoundsCache.Width, panel.Bounds.Height));
        }
    }
}
0 comments