public LayerEditorViewModel(LayerModel layer, IDataModel dataModel, IEnumerable<ILayerType> types,
List<ILayerAnimation> layerAnimations)
{
Layer = layer;
ProposedLayer = Clone(layer);
ProposedLayer.Children.Clear();
DataModel = DataModel;
LayerTypes = new BindableCollection<ILayerType>(types);
LayerAnimations = layerAnimations;
DataModelProps = new BindableCollection<PropertyCollection>(GenerateTypeMap(dataModel));
if (Layer.Properties == null)
Layer.SetupProperties();
// Setup existing conditions
var conditions = layer.Properties.Conditions.Select(c => new LayerConditionViewModel(this, c));
LayerConditionVms = new BindableCollection<LayerConditionViewModel>(conditions);
PropertyChanged += PropertiesViewModelHandler;
// Setup existiing properties
PreSelect();
}