private void VmOnRequestSelectionBoxUpdate(object sender, SelectionBoxUpdateArgs e) { if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Position)) { Canvas.SetLeft(this.selectionBox, e.X); Canvas.SetTop(this.selectionBox, e.Y); } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Dimension)) { selectionBox.Width = e.Width; selectionBox.Height = e.Height; } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Visibility)) { selectionBox.Visibility = e.Visibility; } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Mode)) { if (e.IsCrossSelection && (null == selectionBox.StrokeDashArray)) { selectionBox.StrokeDashArray = new DoubleCollection { 4 } } ; else if (!e.IsCrossSelection && (null != selectionBox.StrokeDashArray)) { selectionBox.StrokeDashArray = null; } } }
private void VmOnRequestSelectionBoxUpdate(object sender, SelectionBoxUpdateArgs e) { var originalLt = new Point(e.X, e.Y); var translatedLt = workBench.TranslatePoint(originalLt, outerCanvas); if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Position)) { Canvas.SetLeft(this.selectionBox, translatedLt.X); Canvas.SetTop(this.selectionBox, translatedLt.Y); } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Dimension)) { var originalRb = new Point(e.X + e.Width, e.Y + e.Height); var translatedRb = workBench.TranslatePoint(originalRb, outerCanvas); selectionBox.Width = translatedRb.X - translatedLt.X; selectionBox.Height = translatedRb.Y - translatedLt.Y; } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Visibility)) { selectionBox.Visibility = e.Visibility; } if (e.UpdatedProps.HasFlag(SelectionBoxUpdateArgs.UpdateFlags.Mode)) { if (e.IsCrossSelection && (null == selectionBox.StrokeDashArray)) { selectionBox.StrokeDashArray = new DoubleCollection { 4 } } ; else if (!e.IsCrossSelection && (null != selectionBox.StrokeDashArray)) { selectionBox.StrokeDashArray = null; } } }