void ArrangeChildRows(ArrangeInfo p_info, TvItem p_item) { if (p_item.Children.Count == 0) { return; } if (p_item.IsExpanded) { foreach (var item in p_item.Children) { var elem = (UIElement)Children[p_info.Index]; elem.Arrange(new Rect(0, p_info.Top, p_info.FinalSize.Width, elem.DesiredSize.Height)); p_info.Top += elem.DesiredSize.Height; p_info.Index++; ArrangeChildRows(p_info, item); } } else { foreach (var item in p_item.Children) { var elem = (UIElement)Children[p_info.Index]; elem.Arrange(_rcEmpty); p_info.Index++; ArrangeChildRows(p_info, item); } } }
void ArrangeRealRows(Size p_finalSize) { ArrangeInfo info = new ArrangeInfo(); info.FinalSize = p_finalSize; foreach (var item in _owner.RootItems) { var elem = (UIElement)Children[info.Index]; elem.Arrange(new Rect(0, info.Top, p_finalSize.Width, elem.DesiredSize.Height)); info.Top += elem.DesiredSize.Height; info.Index++; ArrangeChildRows(info, item); } }