private ResetStoryboard ( double width ) : void | ||
width | double | |
Результат | void |
private void SizeChangedHandler(object sender, SizeChangedEventArgs e) { double actualWidth = ActualWidth; MetroProgressBar bar = this; bar.ResetStoryboard(actualWidth); }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (newValue == oldValue) { return; } var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { var resetAction = new Action(() => { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { bar.ResetStoryboard(bar.ActualSize(true), false); } }); bar.Invoke(resetAction); } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (bar != null && newValue != oldValue) { var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { var resetAction = new Action(() => { bar.InvalidateMeasure(); bar.InvalidateArrange(); bar.ResetStoryboard(bar.ActualWidth, false); }); bar.Dispatcher.BeginInvoke(DispatcherPriority.Background, resetAction); } } } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (bar != null && newValue != oldValue) { VisualState indeterminate = bar.GetIndeterminate(); FrameworkElement templateChild = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminate != null && templateChild != null) { if (oldValue && indeterminate.Storyboard != null) { indeterminate.Storyboard.Stop(templateChild); indeterminate.Storyboard.Remove(templateChild); } if (newValue) { Action action = () => { bar.InvalidateMeasure(); bar.InvalidateArrange(); bar.ResetStoryboard(bar.ActualWidth, false); }; bar.Dispatcher.BeginInvoke(DispatcherPriority.Background, action); } } } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (bar != null && newValue != oldValue) { var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { var resetAction = new Action(() => { bar.InvalidateMeasure(); bar.InvalidateArrange(); bar.ResetStoryboard(bar.ActualWidth, false); }); bar.Dispatcher.BeginInvoke(DispatcherPriority.Background, resetAction); } } } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (newValue == oldValue) { return; } var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { var resetAction = new Action(() => { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { bar.ResetStoryboard(bar.ActualSize(true), false); } }); bar.Invoke(resetAction); } }
private void SizeChangedHandler(object sender, SizeChangedEventArgs e) { double actualWidth = ActualWidth; MetroProgressBar bar = this; if (this.Visibility == System.Windows.Visibility.Visible) { bar.ResetStoryboard(actualWidth); } }
private void SizeChangedHandler(object sender, SizeChangedEventArgs e) { double actualWidth = base.ActualWidth; MetroProgressBar metroProgressBar = this; if (base.Visibility == System.Windows.Visibility.Visible && base.IsIndeterminate) { metroProgressBar.ResetStoryboard(actualWidth, true); } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (bar != null && newValue != oldValue) { var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { bar.ResetStoryboard(bar.ActualWidth, false); } } } }
private static void ToggleIndeterminate(MetroProgressBar bar, bool oldValue, bool newValue) { if (bar != null && newValue != oldValue) { var indeterminateState = bar.GetIndeterminate(); var containingObject = bar.GetTemplateChild("ContainingGrid") as FrameworkElement; if (indeterminateState != null && containingObject != null) { if (oldValue && indeterminateState.Storyboard != null) { // remove the previous storyboard from the Grid #1855 indeterminateState.Storyboard.Stop(containingObject); indeterminateState.Storyboard.Remove(containingObject); } if (newValue) { bar.ResetStoryboard(bar.ActualWidth, false); } } } }