Example #1
0
 static ProgressRing()
 {
     ProgressRing.BindableWidthProperty   = DependencyProperty.Register("BindableWidth", typeof(double), typeof(ProgressRing), new PropertyMetadata(0.0, new PropertyChangedCallback(ProgressRing.BindableWidthCallback)));
     ProgressRing.IsActiveProperty        = DependencyProperty.Register("IsActive", typeof(bool), typeof(ProgressRing), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(ProgressRing.IsActiveChanged)));
     ProgressRing.IsLargeProperty         = DependencyProperty.Register("IsLarge", typeof(bool), typeof(ProgressRing), new PropertyMetadata(true, new PropertyChangedCallback(ProgressRing.IsLargeChangedCallback)));
     ProgressRing.MaxSideLengthProperty   = DependencyProperty.Register("MaxSideLength", typeof(double), typeof(ProgressRing), new PropertyMetadata(0.0));
     ProgressRing.EllipseDiameterProperty = DependencyProperty.Register("EllipseDiameter", typeof(double), typeof(ProgressRing), new PropertyMetadata(0.0));
     ProgressRing.EllipseOffsetProperty   = DependencyProperty.Register("EllipseOffset", typeof(Thickness), typeof(ProgressRing), new PropertyMetadata(default(Thickness)));
     ProgressRing.LoadingPercentProperty  = DependencyProperty.Register("LoadingPercent", typeof(string), typeof(ProgressRing), new PropertyMetadata(default(string)));
     ProgressRing.LoadingNameProperty     = DependencyProperty.Register("LoadingName", typeof(string), typeof(ProgressRing), new PropertyMetadata(default(string)));
     FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(ProgressRing), new FrameworkPropertyMetadata(typeof(ProgressRing)));
     UIElement.VisibilityProperty.OverrideMetadata(typeof(ProgressRing), new FrameworkPropertyMetadata(delegate(DependencyObject ringObject, DependencyPropertyChangedEventArgs e)
     {
         if (e.NewValue != e.OldValue)
         {
             ProgressRing progressRing = (ProgressRing)ringObject;
             if ((Visibility)e.NewValue != Visibility.Visible)
             {
                 progressRing.SetCurrentValue(ProgressRing.IsActiveProperty, false);
                 return;
             }
             progressRing.IsActive = true;
         }
     }));
 }
Example #2
0
        private static void IsActiveChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            ProgressRing progressRing = dependencyObject as ProgressRing;

            if (progressRing == null)
            {
                return;
            }
            progressRing.UpdateActiveState();
        }
Example #3
0
        private static void IsLargeChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            ProgressRing progressRing = dependencyObject as ProgressRing;

            if (progressRing == null)
            {
                return;
            }
            progressRing.UpdateLargeState();
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.uc = ((System.Windows.Controls.LoadingMask)(target));
                return;

            case 2:
                this.grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.pr = ((System.Windows.Controls.ProgressRing)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #5
0
        private static void BindableWidthCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            ProgressRing ring = dependencyObject as ProgressRing;

            if (ring == null)
            {
                return;
            }
            Action action = delegate
            {
                ring.SetEllipseDiameter((double)dependencyPropertyChangedEventArgs.NewValue);
                ring.SetEllipseOffset((double)dependencyPropertyChangedEventArgs.NewValue);
                ring.SetMaxSideLength((double)dependencyPropertyChangedEventArgs.NewValue);
            };

            if (ring._deferredActions != null)
            {
                ring._deferredActions.Add(action);
                return;
            }
            action();
        }