private void SetupGrids(UIElementCollection uIElement) { RowDefinitions.AddAmount(2); SetupHeader(); hideable = new Grid() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Visibility = Collapsed ? Visibility.Collapsed : Visibility.Visible, }; hideable.RowDefinitions.AddAmount(uIElement.Count); for (int i = 0; i < uIElement.Count; i++) { SetRow(uIElement[i], i); hideable.Children.Add(uIElement[i]); } SetRow(hideable, 1); Children.Add(hideable); SetVisibility(Collapsed); }