public LayerListGroupViewModel(IEventAggregator eventAggregator, IAmeSession session, IActionHandler handler, LayerGroup layer) { this.eventAggregator = eventAggregator ?? throw new ArgumentNullException("eventAggregator"); this.session = session ?? throw new ArgumentNullException("session is null"); this.layer = layer ?? throw new ArgumentNullException("layer"); this.actionHandler = handler ?? throw new ArgumentNullException("handler is null"); this.LayerNodes = new ObservableCollection <ILayerListNodeViewModel>(); this.isDragging = false; DrawingGroup drawingGroup = new DrawingGroup(); DrawingGroup filled = new DrawingGroup(); using (DrawingContext context = filled.Open()) { Rect drawingRect = new Rect(0, 0, layer.GetPixelWidth(), layer.GetPixelHeight()); context.DrawRectangle(Brushes.Transparent, new Pen(Brushes.Transparent, 0), drawingRect); } drawingGroup.Children.Add(filled); drawingGroup.Children.Add(layer.Group); this.layerPreview = new DrawingImage(drawingGroup); this.layer.Layers.CollectionChanged += LayersChanged; this.EditTextboxCommand = new DelegateCommand(() => EditTextbox()); this.StopEditingTextboxCommand = new DelegateCommand(() => StopEditingTextbox()); this.MouseLeftButtonDownCommand = new DelegateCommand <object>((point) => HandleLeftClickDown((MouseEventArgs)point)); this.MouseMoveCommand = new DelegateCommand <object>((point) => HandleMouseMove((MouseEventArgs)point)); this.DropCommand = new DelegateCommand <object>((point) => HandleDropCommand((DragEventArgs)point)); this.DragOverCommand = new DelegateCommand <object>((args) => HandleDragOverCommand((DragEventArgs)args)); this.DragEnterCommand = new DelegateCommand <object>((args) => HandleDragEnterCommand((DragEventArgs)args)); this.DragLeaveCommand = new DelegateCommand <object>((args) => HandleDragLeaveCommand((DragEventArgs)args)); }