Hi Telerik,
I noticed something weird going on with my code and I was wondering if there was a way to avoid this scenario.
When I create a RadDock I attach it to a RadDockZone via "RadDockZone.Controls.Add(dock)". This sets the RadDock's Parent to RadDockZone.
When I recreate a RadDock on Page_Init, I allowed the RadDockLayout to move the RadDock into place during RadDockLayout_LoadDockLayout. This sets the RadDock's parent to RadDockLayout.
Thus, this code is necessary and I would like to condense it into something more sensible:
Is my problem clear? How can I avoid this?
I noticed something weird going on with my code and I was wondering if there was a way to avoid this scenario.
When I create a RadDock I attach it to a RadDockZone via "RadDockZone.Controls.Add(dock)". This sets the RadDock's Parent to RadDockZone.
When I recreate a RadDock on Page_Init, I allowed the RadDockLayout to move the RadDock into place during RadDockLayout_LoadDockLayout. This sets the RadDock's parent to RadDockLayout.
Thus, this code is necessary and I would like to condense it into something more sensible:
//The dock's parent can change. When it is first created the dock's parent is the DockZone, but after
//recreation the dock's parent is RadDockLayout.
RadPane pane =
null
;
if
(Parent.GetType() ==
typeof
(CormantRadDockZone))
{
pane = Parent.Parent
as
RadPane;
}
else
{
RadDockLayout dockLayout = Parent
as
RadDockLayout;
RadDockZone zone = dockLayout.RegisteredZones.Where(registeredZone => registeredZone.ID == DockZoneID).FirstOrDefault();
pane = zone.Parent
as
RadPane;
}
try
{
Chart.Height =
new
Unit(pane.Height.Value - 42, UnitType.Pixel);
Chart.Width =
new
Unit(pane.Width.Value - 22, UnitType.Pixel);
}
catch
(Exception ex)
{
Logger.ErrorFormat(
"Unable to adjust chart dimensions. Reason: {0}"
, ex.Message);
}
Is my problem clear? How can I avoid this?