void IQGLayer.OnRemovingControl(IQGControl control) { if (!this.ControlAdorners.ContainsKey(control)) { throw new Exception("Cannot remove control from binding layer: it is not present within the layer."); } control.SetParentLayer(null); QGControlAdorner adorner = this.ControlAdorners[control]; this.ControlAdorners.Remove(control); this.WPFAdornerLayer?.Remove(adorner); this.OnRemovingControl(control); }
void IQGLayer.OnAddingControl(IQGControl control) { control.SetParentLayer(this); QGControlAdorner adorner = new QGControlAdorner(this.ParentControl); this.ControlAdorners.Add(control, adorner); this.WPFAdornerLayer?.Add(adorner); if (control is IWPFContainer wpfContainer) { wpfContainer.RegisterWPFElementInitMethod(__initializeWPFElement); } this.UpdateControlPosition(control); this.OnAddingControl(control); }