using System.Linq; using Stylet; namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree { public class PropertyTreeParentViewModel : PropertyTreeItemViewModel { public PropertyTreeParentViewModel(LayerPropertyViewModel layerPropertyViewModel) { LayerPropertyViewModel = layerPropertyViewModel; Children = new BindableCollection(); foreach (var childProperty in layerPropertyViewModel.Children) { if (childProperty.Children.Any()) Children.Add(new PropertyTreeParentViewModel(childProperty)); else Children.Add(new PropertyTreeChildViewModel(childProperty)); } } public LayerPropertyViewModel LayerPropertyViewModel { get; } public BindableCollection Children { get; set; } public override void Update(bool forceUpdate) { foreach (var child in Children) child.Update(forceUpdate); } } }