コード例 #1
0
        /// <summary>
        /// Check Count property and redraw control with new parameters.
        /// </summary>
        /// <param name="d">LoadingIndicator object whose Count property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void OnCountPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LoadingIndicator ctl = (LoadingIndicator)d;

            int count = (int)e.NewValue;

            if (count <= 0)
            {
                ctl.Count = DefaultCount;
            }

            ctl.CreateAnimation();
        }
コード例 #2
0
        /// <summary>
        /// Stop animation when control becomes collapsed and create it anew - when visible.
        /// </summary>
        /// <param name="d">LoadingIndicator object whose ControlVisibility property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void OnControlVisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LoadingIndicator ctl = (LoadingIndicator)d;

            Visibility visibility = (Visibility)e.NewValue;

            if (ctl.animationElementContainer != null)
            {
                if (visibility == Visibility.Collapsed)
                {
                    ctl.StopAnimation();
                }
                else
                {
                    ctl.StartAnimation();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Called when Duration property is changed.
        /// </summary>
        /// <param name="d">LoadingIndicator object whose Duration property is changed.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs which contains the old and new values.</param>
        private static void OnDurationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LoadingIndicator ctl = (LoadingIndicator)d;

            ctl.CreateAnimation();
        }