public DockItemViewModel(DockItem model) { if (model != null) { Model = model; model.PropertyChanged += (s, e) => { if (e.PropertyName == "Image") { IconImage = ImageToBitmapSource(model.Image); } }; Model = model; IconImage = ImageToBitmapSource(model.Image); Name = model.Name; Width = 60; Height = 60; ContextMenu = model.MenuItems.Select(m => new ContextMenuItemViewModel(m)).ToList(); LeftClickCommand = new RelayCommand(() => Model.OnLeftClick()); } }