protected void UnLinkSubStyle(ISubStyle style, ISubStyle parentProvided) { if (style == null) { return; } style.OnChange -= TriggerChanged; if (parentProvided == null) { return; } // We remove parent provided style. while (style.Parent != null) { if (style.Parent == parentProvided) { style.Parent = null; return; } style = style.Parent; } }
protected void LinkSubStyle(ISubStyle style, ISubStyle parentProvided) { if (style == null) { return; } style.OnChange += TriggerChanged; if (parentProvided == null) { return; } // We link it to parent provided. while (style.Parent != null) { style = style.Parent; } if (style != parentProvided) { style.Parent = parentProvided; } }
protected void ReparentSubStyle(ISubStyle style, ISubStyle prevParentProvided, ISubStyle currentParentProvided) { UnLinkSubStyle(style, prevParentProvided); LinkSubStyle(style, currentParentProvided); }