protected override void OnRefresh() { RectangleDeocration profileRectangle = Visual as RectangleDeocration; if (profileRectangle != null) { _fillBrush = new SolidColorBrush(profileRectangle.FillColor); _imageRect.Width = profileRectangle.Width; _imageRect.Height = profileRectangle.Height; if (profileRectangle.BorderThickness > 0d) { _borderPen = new Pen(new SolidColorBrush(profileRectangle.BorderColor), profileRectangle.BorderThickness); } else { _borderPen = null; } } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { RectangleDeocration profileRectangle = Visual as RectangleDeocration; drawingContext.DrawRoundedRectangle(_fillBrush, _borderPen, _imageRect, profileRectangle.CornerRadius, profileRectangle.CornerRadius); }