private static void OnResizePercentagePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { SelectionCanvas canvas = (SelectionCanvas)source; double resizepercentage = (double)e.NewValue; canvas.Width = canvas.SWidth * (resizepercentage / 100); canvas.Height = canvas.SHeight * (resizepercentage / 100); }
private static void OnImagePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { SelectionCanvas canvas = (SelectionCanvas)source; BitmapSource image = (BitmapSource)e.NewValue; canvas.Width = image.PixelWidth; canvas.Height = image.PixelHeight; canvas.SWidth = image.PixelWidth; canvas.SHeight = image.PixelHeight; canvas.ResizePercentage = 100; canvas.Background = new ImageBrush() { ImageSource = image }; }