Hi Telerik team,
Issue: The location of the RadPanel is locked to 0,0 when its AutoSize property is set to True.
How to reproduce (see also attached demo project):
1. Add a RadPanel in a RadForm. Add some controls into the RadPanel.
2. Set the AutoSize property of the RadPanel to True.
3. The panel cannot be moved in the Designer mode. Setting the Location property programmatically doesn't work, either.
The issue exists in the latest version 2021.1.223, but NOT in the old version 2020.1.218. Guess it's related with some recent update.
Thanks,
Yusi
I have also updated your Telerik points.
Currently, the possible solution that I can suggest is to use the following approach:
public RadForm1()
{
InitializeComponent();
this.radPanel1.Location = new Point(100, 10);
}
public class CustomPanel : RadPanel
{
Point location = Point.Empty;
public override string ThemeClassName
{
get
{
return typeof(RadPanel).FullName;
}
}
protected override void OnVisibleChanged(EventArgs e)
{
location = this.Location;
base.OnVisibleChanged(e);
if (Visible && this.AutoSize)
{
CalcSize();
}
}
protected override void OnLoad(Size desiredSize)
{
location = this.Location;
base.OnLoad(desiredSize);
if (Visible && this.AutoSize)
{
CalcSize();
}
}
protected override void OnControlAdded(ControlEventArgs e)
{
location = this.Location;
base.OnControlAdded(e);
if (Visible && this.AutoSize)
{
CalcSize();
}
}
protected override void OnControlRemoved(ControlEventArgs e)
{
location = this.Location;
base.OnControlRemoved(e);
if (Visible && this.AutoSize)
{
CalcSize();
}
}
protected override void ProcessAutoSizeChanged(bool value)
{
location = this.Location;
base.ProcessAutoSizeChanged(value);
if (Visible && value)
{
CalcSize();
}
}
protected override void OnAutoSizeChanged(EventArgs e)
{
location = this.Location;
base.OnAutoSizeChanged(e);
if (Visible && this.AutoSize)
{
CalcSize();
}
}
private void CalcSize()
{
Size bounds = this.RootElement.DesiredSize.ToSize();
foreach (Control c in Controls)
{
bounds.Width = Math.Max(bounds.Width, c.Right);
bounds.Height = Math.Max(bounds.Height, c.Bottom);
}
bounds.Width += Padding.Right;
bounds.Height += Padding.Bottom;
SetBoundsCore(location.X, location.Y, bounds.Width, bounds.Height, BoundsSpecified.Height | BoundsSpecified.Width);
this.Invalidate();
}
protected override void OnSizeChanged(EventArgs e)
{
location = this.Location;
base.OnSizeChanged(e);
if (this.Visible && this.AutoSize)
{
CalcSize();
}
}
}
Please excuse us for the inconvenience caused. We will do our best to introduce a fix as soon as possible. Please make sure that you follow this item in order to get notified once the status is changed.
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
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.