private void RefreshBackground(double rate) { DrawingBrush drawingBrush = ((DrawingBrush)this.Background).Clone(); Rect rect = (Rect)drawingBrush.GetValue(DrawingBrush.ViewportProperty); drawingBrush.SetValue(DrawingBrush.ViewportProperty, new Rect(0, 0, rect.Width * rate, rect.Height * rate)); this.Background = drawingBrush; }