private async void AddProgressFragment(ProgressFragment item) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var fragmentUI = new ProgressBarFragment(item); ProgressBarCanvas.Children.Add(fragmentUI); CalcProgressBarFragmentPosition(fragmentUI); }); }
private void CalcProgressBarFragmentPosition(ProgressBarFragment fragmentUI, double?width = null) { if (width == null) { width = ProgressBarCanvas.ActualWidth; } fragmentUI.ResetCanvasWidth(width.Value); Canvas.SetLeft(fragmentUI, fragmentUI.ProgressFragment .GetStartPositionInCanvas(width.Value) ); }