using System; using System.Linq; using Artemis.Core; using Artemis.UI.Ninject.Factories; using Stylet; namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings { public class DataBindingsViewModel : Conductor.Collection.AllActive { private readonly IDataBindingsVmFactory _dataBindingsVmFactory; public DataBindingsViewModel(LayerProperty layerProperty, IDataBindingsVmFactory dataBindingsVmFactory) { _dataBindingsVmFactory = dataBindingsVmFactory; LayerProperty = layerProperty; Initialise(); } public LayerProperty LayerProperty { get; } private void Initialise() { var registrations = LayerProperty.GetAllDataBindingRegistrations(); // Create a data binding VM for each data bindable property. These VMs will be responsible for retrieving // and creating the actual data bindings foreach (var registration in registrations) ActivateItem(_dataBindingsVmFactory.DataBindingViewModel(registration)); } } }