Exemple #1
0
 public PropertySettingsCollectionEnumerator(PropertySettingCollection owner)
 {
     this.ownerEnumerator  = ((IEnumerable <IPropertySetting>)owner.innerList).GetEnumerator();
     this.activeEnumerator = this.ownerEnumerator;
     if (owner.inheritedItems != null)
     {
         this.inheritedPropertiesEnumerator = ((IEnumerable <IPropertySetting>)owner.inheritedItems).GetEnumerator();
     }
     else
     {
         this.inheritedPropertiesEnumerator = (IEnumerator <IPropertySetting>)null;
     }
 }
Exemple #2
0
        public void Unregister(RadElement element, PropertySettingCollection propertySettings)
        {
            if (element.IsDisposed)
            {
                return;
            }

            foreach (IPropertySetting setting in propertySettings)
            {
                setting.UnregisterValue(element);
            }

            element.IsStyleSelectorValueSet.Remove(this.GetHashCode());
        }
Exemple #3
0
        public void Apply(RadElement element, PropertySettingCollection propertySettings)
        {
            bool shouldApply               = true;
            bool shouldUnapply             = false;
            bool applyConditionEvaluated   = false;
            bool unApplyConditionEvaluated = false;

            if (this.condition != null || this.unapplyCondition != null)
            {
                applyConditionEvaluated = CanSelect(element);

                shouldApply = applyConditionEvaluated &&
                              (!this.IsValueApplied(element) || this.IsValueUnapplied(element));
                if (!shouldApply)
                {
                    unApplyConditionEvaluated = ShouldUnapply(element);
                    shouldUnapply             = ShouldUnapply(element) && this.IsValueApplied(element);
                }
            }

            if (shouldApply)
            {
                foreach (IPropertySetting setting in propertySettings)
                {
                    setting.ApplyValue(element);
                }
            }
            //else if (shouldUnapply)
            //{
            //    PropertySettingGroup group = element.GetInitialStyle();
            //    if (group != null)
            //    {
            //        for (int i = 0; i < group.PropertySettings.Count; i++)
            //        {
            //            IPropertySetting setting = group.PropertySettings[i];
            //            setting.ApplyValue(element);
            //        }
            //    }
            //    else
            //    {
            //        for (int i = 0; i < propertySettings.Count; i++)
            //        {
            //            IPropertySetting setting = propertySettings[i];
            //            element.ResetValue(setting.Property, ValueResetFlags.Style);
            //        }
            //    }
            //}

            if (this.condition != null || this.unapplyCondition != null)
            {
                if (applyConditionEvaluated)
                {
                    element.IsStyleSelectorValueSet[this.GetHashCode()] = true;
                }
                else if (unApplyConditionEvaluated)
                {
                    element.IsStyleSelectorValueSet[this.GetHashCode()] = false;
                }
                else
                {
                    element.IsStyleSelectorValueSet.Remove(this.GetHashCode());
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the RoutedEventStyleBehavior class using
 /// the fired routed event, element selector, and property settings.
 /// </summary>
 /// <param name="raisedRoutedEvent"></param>
 /// <param name="selector"></param>
 /// <param name="propertySettings"></param>
 public RoutedEventStyleBehavior(RaisedRoutedEvent raisedRoutedEvent, IElementSelector selector, PropertySettingCollection propertySettings)
     : base(raisedRoutedEvent)
 {
     this.selector         = selector;
     this.propertySettings = propertySettings;
 }
Exemple #5
0
 public NotAppliedSelector(IElementSelector selector, PropertySettingCollection propertySettings)
 {
     this.selector         = selector;
     this.propertySettings = propertySettings;
 }
 /// <summary>
 /// Initializes a new instance of the PropertyChangeStyleBehavior class.
 /// </summary>
 /// <param name="executeBehaviorPropertyTrigger"></param>
 /// <param name="selector"></param>
 /// <param name="propertySettings"></param>
 public PropertyChangeStyleBehavior(RadProperty executeBehaviorPropertyTrigger, IElementSelector selector, PropertySettingCollection propertySettings)
     : base(executeBehaviorPropertyTrigger)
 {
     this.selector         = selector;
     this.propertySettings = propertySettings;
 }