/// <summary> /// Add crop to the new image. /// </summary> private void AddCropToElement() { if (_felCur != null) { RemoveCropFromCur(); } var rcInterior = new Rect( ActualWidth*0.2, ActualHeight*0.2, ActualWidth*0.6, ActualHeight*0.6); var aly = AdornerLayer.GetAdornerLayer(this); _clp = new CroppingAdorner(this, rcInterior); var clr = Colors.Black; clr.A = 110; _clp.Fill = new SolidColorBrush(clr); if (aly != null) { aly.Add(_clp); OutputImage = _clp.BpsCrop(); _clp.CropChanged += CropChanged; _felCur = this; } }