public void Refresh(double width) { if (this.indicatorContainer != null && this.indicatorContainer.Children != null) { foreach (UIElement uie in this.indicatorContainer.Children) { Rectangle rectangle = uie as Rectangle; if (rectangle != null) { ProgresIndicator progressIndicator = rectangle.Tag as ProgresIndicator; if (progressIndicator != null) { var rectangleWidth = width * (progressIndicator.DownloadProgress - progressIndicator.DownloadProgressOffset); rectangle.Width = width <= 0 ? 0 : width; rectangle.SetValue(Canvas.LeftProperty, width * progressIndicator.DownloadProgressOffset); } } } } }