public override void ItemStateChanged(
     RadObject senderItem,
     RadPropertyChangedEventArgs changeArgs)
 {
     if (senderItem is RadCheckBoxElement)
     {
         RadCheckBoxElement radCheckBoxElement = senderItem as RadCheckBoxElement;
         if (changeArgs != (RadPropertyChangedEventArgs)null && !radCheckBoxElement.Enabled && radCheckBoxElement.ToggleState != ToggleState.Off)
         {
             string str = "ToggleState=" + (radCheckBoxElement.ToggleState == ToggleState.On ? "On" : "Intermediate");
             this.SetItemState(senderItem, "Disabled" + (object)'.' + str);
         }
         else
         {
             base.ItemStateChanged(senderItem, changeArgs);
         }
     }
     else if (senderItem is RadRadioButtonElement)
     {
         base.ItemStateChanged(senderItem, changeArgs);
     }
     else
     {
         RadToggleButtonElement toggleButtonElement = senderItem as RadToggleButtonElement;
         if (changeArgs != (RadPropertyChangedEventArgs)null && !toggleButtonElement.Enabled && toggleButtonElement.ToggleState == ToggleState.On)
         {
             this.SetItemState(senderItem, "Disabled" + (object)'.' + "ToggleState=On");
         }
         else
         {
             base.ItemStateChanged(senderItem, changeArgs);
         }
     }
 }
示例#2
0
        public override void ItemStateChanged(RadObject item, RadPropertyChangedEventArgs changeArgs)
        {
            string  str     = string.Empty;
            RadItem radItem = item as RadItem;

            if (radItem != null && !radItem.Enabled)
            {
                str = "Disabled";
            }
            RadCheckmark radCheckmark = item as RadCheckmark;

            if (radCheckmark.CheckState == ToggleState.On)
            {
                if (!string.IsNullOrEmpty(str))
                {
                    str += (string)(object)'.';
                }
                str += "ToggleState=On";
            }
            if (radCheckmark.CheckState == ToggleState.Indeterminate)
            {
                if (!string.IsNullOrEmpty(str))
                {
                    str += (string)(object)'.';
                }
                str += "ToggleState=Indeterminate";
            }
            this.SetItemState(item, str);
        }
        public override bool ShouldSerializeValue(object component)
        {
            bool?serializeFromRadobject = this.GetShouldSerializeFromRadobject(component);

            if (serializeFromRadobject.HasValue && serializeFromRadobject.HasValue)
            {
                return(serializeFromRadobject.Value);
            }
            RadObject        component1    = (RadObject)component;
            RadProperty      radProperty   = this.GetRadProperty(component1);
            RadPropertyValue propertyValue = component1.GetPropertyValue(radProperty);

            if (propertyValue == null || propertyValue.ValueSource != ValueSource.Local && propertyValue.ValueSource != ValueSource.LocalFromBinding)
            {
                return(false);
            }
            if (radProperty == RadElement.BoundsProperty)
            {
                return(!(bool)component1.GetValue(RadElement.AutoSizeProperty));
            }
            if (propertyValue.IsSetAtDesignTime)
            {
                return(true);
            }
            return(this.Wrapped.ShouldSerializeValue(component));
        }
示例#4
0
        protected void SetItemState(RadObject item, params string[] stateNames)
        {
            if (item == null)
            {
                return;
            }
            IStylableElement stylableElement = item as IStylableElement;

            if (stylableElement == null)
            {
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(stylableElement.ThemeRole);
            if (stateNames != null && stateNames.Length > 0 && stateNames[0].Length > 0)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append('.');
                }
                stringBuilder.Append(string.Join(ItemStateManagerBase.stateDelimiterString, stateNames));
            }
            stylableElement.VisualState = stringBuilder.ToString();
        }
 public RadProperty GetRadProperty(RadObject component)
 {
     if (this.radProperty == null)
     {
         this.radProperty = component.GetRegisteredRadProperty(this.Name);
     }
     return(this.radProperty);
 }
示例#6
0
 public void Add(RadObject d, RadProperty dp)
 {
     if (++DependentList._skipper % (1 + this.Count / 4) == 0)
     {
         this.CleanUpDeadWeakReferences(true);
     }
     this.Add(new Dependent(d, dp));
 }
示例#7
0
        public virtual StateManagerAttachmentData AttachToItem(RadObject item)
        {
            StateManagerAttachmentData attachData = new StateManagerAttachmentData(item, new RadItemStateChangedEventHandler(this.ItemStateChanged));

            this.AttachToItemOverride(attachData, item);
            this.ItemStateChanged(item, (RadPropertyChangedEventArgs)null);
            return(attachData);
        }
 public StateManagerAttachmentData(
     RadObject elementToAttachTo,
     RadItemStateChangedEventHandler eventHandler)
 {
     this.eventHandler      = eventHandler;
     this.elementToAttachTo = elementToAttachTo;
     elementToAttachTo.RadPropertyChanged += new RadPropertyChangedEventHandler(this.attachedElement_RadPropertyChanged);
 }
 public override void AttachToElement(RadObject item, StateManagerAttachmentData attachmentData)
 {
     base.AttachToElement(item, attachmentData);
     if (this.condition == null)
     {
         return;
     }
     attachmentData.AddEventHandlers(this.condition.AffectedProperties);
 }
示例#10
0
        private RadProperty GetRadProperty(RadObject component)
        {
            if (radProperty == null)
            {
                radProperty = component.GetRegisteredRadProperty(this.Name);
            }

            return(radProperty);
        }
        public virtual void Collapse(bool ignoreIsExpanded, bool stopAnimations)
        {
            this.ownerControl.LoadElementTree();
            bool isExpanded = ignoreIsExpanded || this.IsExpanded;

            if (this.IsAnimating || !isExpanded || (this.ElementTree.RootElement.ElementState != ElementState.Loaded || this.preventExpandCollapse) || !this.OnCollapsing())
            {
                return;
            }
            this.ExecuteCollapsePreparations();
            bool previousIsAnimatingValue = false;

            if (stopAnimations)
            {
                previousIsAnimatingValue = this.EnableAnimation;
                this.EnableAnimation     = false;
            }
            AnimatedPropertySetting       animation = this.CreateAnimation(isExpanded);
            AnimationFinishedEventHandler animationFinishedHandler = (AnimationFinishedEventHandler)null;

            animationFinishedHandler = (AnimationFinishedEventHandler)((param0, param1) =>
            {
                this.preventExpandCollapse = true;
                animation.AnimationFinished -= animationFinishedHandler;
                this.IsExpanded = false;
                if (stopAnimations)
                {
                    this.EnableAnimation = previousIsAnimatingValue;
                }
                this.preventExpandCollapse = false;
                this.ExecuteCollapseFinalizations();
                int num = (int)this.SetAnimatedObjectValue(animation.Property, animation.EndValue);
                this.OnCollapsed();
            });
            animation.AnimationFinished += animationFinishedHandler;
            RadObject objectToBeAnimated = this.GetObjectToBeAnimated();

            if (this.EnableAnimation)
            {
                animation.ApplyValue(objectToBeAnimated);
            }
            else
            {
                bool animationsEnabled = AnimatedPropertySetting.AnimationsEnabled;
                AnimatedPropertySetting.AnimationsEnabled = false;
                animation.NumFrames = 1;
                animation.Interval  = 1;
                animation.ApplyValue(objectToBeAnimated);
                AnimatedPropertySetting.AnimationsEnabled = animationsEnabled;
            }
            if (!this.ElementTree.RootElement.EnableElementShadow)
            {
                return;
            }
            this.ownerControl.RootElement.PaintControlShadow();
        }
示例#12
0
        private static bool IsValidDock(object value, RadObject obj)
        {
            Dock dock = (Dock)value;

            if (((dock != Dock.Left) && (dock != Dock.Top)) && (dock != Dock.Right))
            {
                return(dock == Dock.Bottom);
            }
            return(true);
        }
示例#13
0
 public RadPageViewPage()
 {
     this.SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.OptimizedDoubleBuffer, true);
     this.Visible           = false;
     this.stylePlaceholder  = new RadObject();
     this.TextImageRelation = TextImageRelation.ImageBeforeText;
     this.ImageAlignment    = ContentAlignment.MiddleLeft;
     this.TextAlignment     = ContentAlignment.MiddleLeft;
     this.stylePlaceholder.PropertyValues.SetLocalValuesAsDefault();
 }
示例#14
0
        public virtual string GetInitialState(RadObject item)
        {
            IStylableElement stylableElement = item as IStylableElement;

            if (stylableElement != null)
            {
                return(stylableElement.ThemeRole);
            }
            return(item.GetType().Name);
        }
示例#15
0
 protected override void AttachToItemOverride(
     StateManagerAttachmentData attachmentData,
     RadObject item)
 {
     if (this.rootState == null)
     {
         return;
     }
     this.rootState.AttachToElement(item, attachmentData);
 }
示例#16
0
        public override bool IsValid(RadObject testElement, string state)
        {
            RadElement radElement = testElement as RadElement;

            if (this.internalSelector != null && radElement != null)
            {
                return(this.internalSelector.CanSelect((RadObject)radElement));
            }
            return(false);
        }
示例#17
0
        public void InvalidateDependents(RadObject source, RadProperty sourceDP)
        {
            Dependent[] array = this.ToArray();
            int         num   = 0;

            while (num < array.Length)
            {
                ++num;
            }
        }
示例#18
0
 protected override void AttachToItemOverride(
     StateManagerAttachmentData attachData,
     RadObject item)
 {
     attachData.AddEventHandlers(new List <RadProperty>(2)
     {
         RadCheckmark.CheckStateProperty,
         RadElement.EnabledProperty
     });
 }
示例#19
0
        protected override bool CanSelectOverride(RadObject element)
        {
            IStylableElement stylableElement = element as IStylableElement;

            if (stylableElement != null)
            {
                return(string.CompareOrdinal(stylableElement.VisualState, this.visualState) == 0);
            }
            return(false);
        }
示例#20
0
        private static void OnDockChanged(RadObject obj, RadPropertyChangedEventArgs e)
        {
            RadElement radElement = obj as RadElement;

            if (radElement == null)
            {
                return;
            }
            (radElement.Parent as DockLayoutPanel)?.InvalidateMeasure();
        }
示例#21
0
 public override StyleGroup ResolveStyleGroupForElement(
     StyleGroup styleGroup,
     RadObject element)
 {
     if ((element is RadSplitButtonElement || element is RadDropDownButtonElement) && this.ElementTree.Theme != null)
     {
         return(this.ElementTree.Theme.FindStyleGroup(element as IStylableNode));
     }
     return(base.ResolveStyleGroupForElement(styleGroup, element));
 }
示例#22
0
 public RadPropertyBinding(
     RadObject bindingSourceObject,
     RadProperty fromProperty,
     RadProperty bindingSourceProperty,
     PropertyBindingOptions options)
 {
     this.bindingSourceObject = bindingSourceObject;
     this.fromProperty        = fromProperty;
     this.toProperty          = bindingSourceProperty;
     this.options             = options;
 }
        private static CarouselPathAnimationData GetItemAnimationData(
            RadObject element)
        {
            CarouselPathAnimationData pathAnimationData = (CarouselPathAnimationData)element.GetValue(CarouselItemsContainer.CarouselAnimationData);

            if (pathAnimationData == null)
            {
                pathAnimationData = new CarouselPathAnimationData();
                int num = (int)element.SetValue(CarouselItemsContainer.CarouselAnimationData, (object)pathAnimationData);
            }
            return(pathAnimationData);
        }
示例#24
0
 public virtual void AttachToElement(RadObject item, StateManagerAttachmentData attachmentData)
 {
     if (this.trueStateLink != null)
     {
         this.trueStateLink.AttachToElement(item, attachmentData);
     }
     if (this.falseStateLink == null)
     {
         return;
     }
     this.falseStateLink.AttachToElement(item, attachmentData);
 }
示例#25
0
 public override void AttachToElement(RadObject item, StateManagerAttachmentData attachmentData)
 {
     base.AttachToElement(item, attachmentData);
     if (this.states == null)
     {
         return;
     }
     foreach (StateNodeBase state in this.states)
     {
         state.AttachToElement(item, attachmentData);
     }
 }
示例#26
0
        public virtual bool IsCompatible(RadObject element)
        {
            IStylableNode stylableNode = element as IStylableNode;

            if (stylableNode == null)
            {
                return(false);
            }
            if (this.type == ElementSelectorTypes.VisualStateSelector)
            {
                IStylableElement stylableElement = element as IStylableElement;
                string           str             = stylableElement != null ? stylableElement.ThemeRole : element.GetType().Name;
                if (this.value.StartsWith(str))
                {
                    return(true);
                }
                return(str == this.value);
            }
            if (this.type == ElementSelectorTypes.ClassSelector)
            {
                if (this.childSelector == null || this.childSelector.Type != ElementSelectorTypes.VisualStateSelector)
                {
                    return(stylableNode.Class == this.value);
                }
                if (this.childSelector.IsCompatible(element))
                {
                    for (IStylableNode parent = stylableNode.Parent; parent != null; parent = parent.Parent)
                    {
                        if (parent.Class == this.value)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            if (this.type != ElementSelectorTypes.TypeSelector)
            {
                return(false);
            }
            if (this.childSelector == null || this.childSelector.Type != ElementSelectorTypes.VisualStateSelector || !this.childSelector.IsCompatible(element))
            {
                return(stylableNode.GetThemeEffectiveType().FullName == this.value);
            }
            for (IStylableNode parent = stylableNode.Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetThemeEffectiveType().FullName == this.value)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#27
0
        private static void OnDockChanged(RadObject obj, RadPropertyChangedEventArgs e)
        {
            RadElement reference = obj as RadElement;

            if (reference != null)
            {
                DockLayoutPanel panel = reference.Parent as DockLayoutPanel;
                if (panel != null)
                {
                    panel.InvalidateMeasure();
                }
            }
        }
示例#28
0
        private static CarouselPathAnimationData GetItemAnimationData(RadObject element)
        {
            CarouselPathAnimationData data =
                (CarouselPathAnimationData)element.GetValue(CarouselItemsContainer.CarouselAnimationData);

            if (data == null)
            {
                data = new CarouselPathAnimationData();
                element.SetValue(CarouselItemsContainer.CarouselAnimationData, data);
            }

            return(data);
        }
示例#29
0
        public override ICollection <string> EvaluateState(RadObject targetItem)
        {
            ICollection <string> strings = (ICollection <string>) new LinkedList <string>();

            foreach (StateNodeBase state in this.states)
            {
                foreach (string str in (IEnumerable <string>)state.EvaluateState(targetItem))
                {
                    strings.Add(str);
                }
            }
            return(strings);
        }
示例#30
0
        private static bool IsWidthHeightValid(object value, RadObject obj)
        {
            float num = (float)value;

            if (float.IsNaN(num))
            {
                return(true);
            }
            if (num >= 0)
            {
                return(!float.IsPositiveInfinity(num));
            }
            return(false);
        }