private void AddCropToElement(FrameworkElement fel) { if (_felCur != null) { return; } var rcInterior = new Rect( 0, 0, fel.ActualWidth, fel.ActualHeight); var adornerLayer = AdornerLayer.GetAdornerLayer(fel); _clp = new CroppingAdorner(fel, rcInterior); _felCur = fel; var color = Colors.Black; color.A = 180; _clp.Fill = new SolidColorBrush(color); adornerLayer.Add(_clp); adornerLayer.UpdateLayout(); var dx = 1d / _clp.ClippingRectangle.Width * _imageWidth; var dy = 1d / _clp.ClippingRectangle.Height * _imageHeight; _clp.SetClippingRectangle(new Rect( Configuration.Configuration.Instance.Settings.ClippingRectangle.X / dx, Configuration.Configuration.Instance.Settings.ClippingRectangle.Y / dy, Configuration.Configuration.Instance.Settings.ClippingRectangle.Width / dx, Configuration.Configuration.Instance.Settings.ClippingRectangle.Height / dy )); UpdateClippingRectangle(); _clp.CropChanged += (sender, args) => { UpdateClippingRectangle(); }; Image.SizeChanged += ImageSizeChanged; }