private void OnPropertyValueChanged(object sender, EventArgs e) { var value = AssociatedObject.GetValue(descriptor.DependencyProperty); if (PropertyChangedCommand == null || !PropertyChangedCommand.CanExecute(value)) { return; } PropertyChangedCommand.Execute(value); }
protected override void OnMouseDown(MouseButtonEventArgs e) { base.OnMouseDown(e); _propertyChangeCommands = new List <PropertyChangedCommand>(); if (this.DataContext is DesignerItem dataContextDesignerItem && dataContextDesignerItem.Parent is DesignerCanvas designer) { var designerItems = designer.SelectionService.CurrentSelection.OfType <DesignerItem>(); foreach (DesignerItem item in designerItems) { if (item.DataContext is ElementVM elementvm) { Element element = elementvm.Element; PropertyChangedCommand newPropertyChangedCommand = new PropertyChangedCommand(element.Position, element.Position, nameof(element.Position), element, false); _propertyChangeCommands.Add(newPropertyChangedCommand); } else { throw new Exception("DataContext of DesignerItem should be type of ElementVM"); } } }