internal DockControlLayout GetNormalized() { var layout = new DockControlLayout(); var flatDictionary = new Dictionary <string, DockItemState>(); TreeEnumeratorAdvisor.Visit(Items, (s, e) => layout.MergeLayout(s, e)); TreeEnumeratorAdvisor.ReverseVisit(Items, w => { if (w.ItemName != null && w.HasLocalValue(DockItemLayout.DockStateProperty)) { flatDictionary[w.ItemName] = w.DockState; } }); TreeEnumeratorAdvisor.ReverseVisit(layout.Items, w => { if (w.ItemName != null && flatDictionary.TryGetValue(w.ItemName, out var state)) { w.DockState = state; } }); layout.BuildIndices(); return(layout); }
internal void CopyFrom(DockControlLayout source) { Items.Clear(); Items.AddRange(Items.Select(l => l.Clone())); }