Last Updated:
28 Mar 2024 12:00
by Steven
LayoutControl uses XamlWriter.Save/XamlReader.Load when custom items/controls are added in its toolbox.
For example:
LayoutControlHierarchicalNodeProxy radGridToolBoxProxy = new LayoutControlHierarchicalNodeProxy();
radGridToolBoxProxy.Header = "RadGrid";
radGridToolBoxProxy.OriginalItemType = typeof(RadGridView);
radGridToolBoxProxy.OriginalItem = new RadGridView() { };
this.toolBoxView.NewItems.Add(radGridToolBoxProxy);
OnDrop in LayoutControl, internally a deep copy is created of the object via XamlWriter.Save and XamlReader.Load. but this has lots of limitations and not every custom control can be successfully restored.
Add event or other API so that user can have control of the creation of the element when drag drop from toolbos is performed.