protected override void UpdateBackground() { if (this.Element.IsBackgroundManagedByStyle) { this.DisposeDrawableBackground(); this.SetBackground(null); return; } if (this.Element.Background is DrawingBrush drawingBrush) { this.drawableBackground = this.UpdateBackground(this.Element, drawingBrush); } else { base.UpdateBackground(); this.DisposeDrawableBackground(); } }
private void DisposeDrawableBackground() { this.drawableBackground?.Dispose(); this.drawableBackground = null; }