The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi, I have docked a control using the following code below however I would then like to replace this docked control with another control.
public void DockControl(Control c, Control parent, string name, int size, DockingStyle dockingStyle) { m_dockingManager.BeginInit(); m_dockingManager.DockControl(c, parent, dockingStyle, size); m_dockingManager.SetDockLabel(c, name); m_dockingManager.SetDockAbility(c, DockAbility.None); m_dockingManager.EndInit(); }
My attemp to replace the control was to loop through the controls array and replace it however there is only a getter not a setter method...
public void ReplaceDockControl(Control c, Control replace) { int index = -1; for (int i = 0; i < m_dockingManager.ControlsArray.Length; i++) { if (m_dockingManager.ControlsArray[i] == c) { index = i; break; } }
if (index > -1) { m_dockingManager.ControlsArray[index] = replace; } }
MJMano J Syncfusion Team October 27, 2009 10:00 AM UTC
Hi David,
You can't replace a control unless you disable docking for the control.
You have to do the following in your code (ReplaceControl method) to achieve your requirement. if (index > -1) { Control ctrl = dockingManager.ControlsArray[index]; // Get the properties from the controls Control parent = ctrl.Parent.Parent; Size size = dockingManager.GetControlSize(ctrl); DockingStyle style = dockingManager.GetDockStyle(ctrl); // Disable docking for the control. dockingManager.SetEnableDocking(ctrl, false); // dispose the control ctrl.Dispose(); // replace with new control DockControl(replace, parent, replace.Name, size.Width, style); }