public PropertySettingGroup Deserialize()
        {
            PropertySettingGroup propertySettingGroup = new PropertySettingGroup();

            propertySettingGroup.BasedOn = this.basedOn;
            if (this.propertySettings != null)
            {
                for (int index = 0; index < this.PropertySettings.Count; ++index)
                {
                    IPropertySetting propertySetting = this.PropertySettings[index].Deserialize();
                    if (propertySetting is PropertySetting)
                    {
                        propertySettingGroup.PropertySettings.Add(propertySetting as PropertySetting);
                    }
                }
            }
            if (this.selectors != null)
            {
                for (int index = 0; index < this.Selectors.Count; ++index)
                {
                    IElementSelector internalSelector = this.Selectors[index].Deserialize();
                    propertySettingGroup.Selector = (ElementSelector) new WrapSelector(internalSelector);
                }
            }
            return(propertySettingGroup);
        }
        public PropertySettingGroup Deserialize()
        {
            PropertySettingGroup group = new PropertySettingGroup();

            group.BasedOn = this.basedOn;

            if (this.propertySettings != null)
            {
                for (int settingIndex = 0; settingIndex < this.PropertySettings.Count; settingIndex++)
                {
                    XmlPropertySetting xmlPropertySetting = this.PropertySettings[settingIndex];
                    IPropertySetting   setting            = xmlPropertySetting.Deserialize();
                    group.PropertySettings.Add(setting);
                }
            }

            if (this.selectors != null)
            {
                for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++)
                {
                    XmlElementSelector xmlSelector = this.Selectors[selectorIndex];
                    IElementSelector   selector    = xmlSelector.Deserialize();
                    group.Selectors.Add(selector);
                }
            }

            return(group);
        }
Example #3
0
 internal void Dispose()
 {
     ++this.lockComposeCount;
     ++this.lockValueUpdateCount;
     if (this.owner != null)
     {
         this.owner.RemoveBinding(this);
     }
     if (this.boundObjects != null)
     {
         for (int index = this.boundObjects.Count - 1; index >= 0; --index)
         {
             PropertyBoundObject boundObject = this.boundObjects[index];
             RadObject           radObject   = boundObject.Object;
             if (radObject != null && !radObject.IsDisposed && !radObject.IsDisposing)
             {
                 int num = (int)radObject.UnbindProperty(boundObject.Property);
             }
         }
         this.boundObjects.Clear();
     }
     this.property         = (RadProperty)null;
     this.metadata         = (RadPropertyMetadata)null;
     this.owner            = (RadObject)null;
     this.propertyBinding  = (PropertyBinding)null;
     this.animationSetting = (AnimatedPropertySetting)null;
     this.styleSetting     = (IPropertySetting)null;
 }
Example #4
0
        public XmlPropertySettingGroup Serialize()
        {
            XmlPropertySettingGroup xmlGroup = new XmlPropertySettingGroup();

            xmlGroup.BasedOn = this.basedOn;

            for (int settingIndex = 0; settingIndex < this.PropertySettings.OriginalPropertySettings.Count; settingIndex++)
            {
                IPropertySetting setting = this.PropertySettings.OriginalPropertySettings[settingIndex];
                //serialize value;
                XmlPropertySetting xmlSetting = setting.Serialize();
                xmlGroup.PropertySettings.Add(xmlSetting);
            }

            if (this.Selectors.Count > 0)
            {
                for (int selectorIndex = 0; selectorIndex < this.Selectors.Count; selectorIndex++)
                {
                    IElementSelector selector = this.Selectors[selectorIndex];
                    xmlGroup.Selectors.Add(selector.Serialize());
                }
            }

            return(xmlGroup);
        }
Example #5
0
        public void InheritRepositoryItem(Telerik.WinControls.Styles.XmlRepositoryItem newItem)
        {
            for (int i = 0; i < newItem.DeserializedPropertySettings.Count; i++)
            {
                IPropertySetting newSetting = newItem.DeserializedPropertySettings[i];

                bool found = false;
                for (int k = 0; k < this.propertySettings.OriginalPropertySettings.Count; k++)
                {
                    PropertySetting existingSetting = this.propertySettings.OriginalPropertySettings[k] as PropertySetting;

                    if (existingSetting != null &&
                        existingSetting.Property == newSetting.Property)
                    {
                        //Settingd defined in inherited groups beat those from repository, so no value copy
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    this.propertySettings.AddInheritedPropertySetting(newSetting, newItem.ItemType);
                }
            }
        }
Example #6
0
        private void InitializeVisibilityModifierValue(IPropertySetting setting)
        {
            PropertySetting propSetting = setting as PropertySetting;

            if (propSetting == null || !(propSetting.Value is ElementVisibility))
            {
                return;
            }
            this.visibilityModifierValue = (ElementVisibility)propSetting.Value;
        }
 public InheritedSetting(string type, RadProperty property)
 {
     this.settingType = type;
     this.setting     = null;
     this.property    = property;
     this.hash        = this.property.NameHash;
     if (!string.IsNullOrEmpty(type))
     {
         this.hash ^= type.GetHashCode();
     }
 }
 public InheritedSetting(string type, IPropertySetting setting)
 {
     this.settingType = type;
     this.setting     = setting;
     this.property    = setting.Property;
     this.hash        = this.property.NameHash;
     if (!string.IsNullOrEmpty(type))
     {
         this.hash ^= type.GetHashCode();
     }
 }
Example #9
0
 internal void Copy(RadPropertyValue source)
 {
     this.valueSource           = source.valueSource;
     this.localValue            = source.localValue;
     this.localValueFromBinding = source.localValueFromBinding;
     this.defaultValueOverride  = source.defaultValueOverride;
     this.currentValue          = source.currentValue;
     this.iscurrentValueCoerced = source.iscurrentValueCoerced;
     this.isSetAtDesignTime     = source.isSetAtDesignTime;
     this.animationSetting      = source.animationSetting;
     this.styleSetting          = source.styleSetting;
     this.propertyBinding       = source.propertyBinding;
     this.animatedValue         = source.animatedValue;
 }
Example #10
0
 public virtual void RemoveStylePropertySetting(IPropertySetting setting)
 {
     this.RemoveStylePropertySetting(setting.Property);
 }
Example #11
0
        protected override Condition CreateInstance()
        {
            IPropertySetting setting = this.Setting.Deserialize();

            return(new SimpleCondition(setting, this.UnaryOperator));
        }
Example #12
0
 /// <summary>
 /// Applies the specified style setting and forces current value re-evaluation.
 /// </summary>
 /// <param name="setting"></param>
 internal void SetStyle(IPropertySetting setting)
 {
     this.styleSetting = setting;
     this.valueSource  = ValueSource.Unknown;
 }
Example #13
0
 public SimpleCondition(RadProperty property, object value)
 {
     this.setting = (IPropertySetting) new PropertySetting(property, value);
 }
Example #14
0
 public SimpleCondition(RadProperty property, object value, UnaryOperator unaryOperator)
 {
     this.setting       = (IPropertySetting) new PropertySetting(property, value);
     this.unaryOperator = unaryOperator;
 }
Example #15
0
 public SimpleCondition(IPropertySetting settingToCheck, UnaryOperator unaryOperator)
 {
     this.setting       = settingToCheck;
     this.unaryOperator = unaryOperator;
 }
Example #16
0
 public SimpleCondition(IPropertySetting settingToCheck)
 {
     this.setting = settingToCheck;
 }
 /// <summary>
 /// 初始化一个<see cref="PropertyConfiguration"/>类型的实例
 /// </summary>
 /// <param name="propertySetting">属性设置</param>
 public PropertyConfiguration(IPropertySetting propertySetting)
 {
     _propertySetting = propertySetting as PropertySetting;
 }
Example #18
0
        /// <summary>
        /// This method supports TPF infrastructure and is intended for internal use only.
        /// </summary>
        /// <param name="applyUnconditional"></param>
        /// <param name="groups"></param>
        /// <returns></returns>
        public StyleSheet GetStyleSheet(XmlSelectorBase applyUnconditional, XmlPropertySettingGroup[] groups)
        {
            StyleSheet   res           = new StyleSheet();
            SelectorBase applySelector = null;

            if (this.PropertySettingGroups == null)
            {
                return(res);
            }

            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i];
                if (xmlGroup.Selectors != null)
                {
                    for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++)
                    {
                        XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex];
                        if (xmlSelector == applyUnconditional)
                        {
                            applySelector = (SelectorBase)xmlSelector.Deserialize();
                            break;
                        }
                    }
                }
            }

            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i];
                PropertySettingGroup    group    = new PropertySettingGroup();

                if (xmlGroup.PropertySettings == null ||
                    xmlGroup.Selectors == null)
                {
                    continue;
                }

                bool disable = false;
                if (applyUnconditional != null)
                {
                    for (int groupIndex = 0; groupIndex < groups.Length; groupIndex++)
                    {
                        XmlPropertySettingGroup g = groups[groupIndex];
                        if (g == xmlGroup)
                        {
                            disable = true;
                            break;
                        }
                    }
                }

                for (int settingIndex = 0; settingIndex < xmlGroup.PropertySettings.Count; settingIndex++)
                {
                    XmlPropertySetting xmlPropertySetting = xmlGroup.PropertySettings[settingIndex];
                    IPropertySetting   setting            = xmlPropertySetting.Deserialize();
                    group.PropertySettings.Add(setting);
                }

                //IElementSelector activeSelector = null;

                for (int selectorIndex = 0; selectorIndex < xmlGroup.Selectors.Count; selectorIndex++)
                {
                    XmlElementSelector xmlSelector = xmlGroup.Selectors[selectorIndex];
                    IElementSelector   selector    = null;
                    selector = xmlSelector.Deserialize();

                    if (xmlSelector == applyUnconditional)
                    {
                        applySelector.IsActiveSelectorInStyleBuilder = true;
                        selector = applySelector;
                        //continue;
                    }
                    else if (disable)
                    {
                        ((SelectorBase)selector).DisableStyle = true;
                        //((SelectorBase)selector).ExcludeSelector = applySelector;
                    }

                    group.Selectors.Add(selector);
                }

                //if (activeSelector != null)
                //	group.Selectors.Insert(0, activeSelector);

                res.PropertySettingGroups.Add(group);
            }

            return(res);
        }
Example #19
0
 protected internal virtual ValueUpdateResult AddStylePropertySetting(
     IPropertySetting setting)
 {
     return(this.SetValueCore(this.propertyValues.GetEntry(setting.Property, true), (object)setting, (object)null, ValueSource.Style));
 }
Example #20
0
        /// <summary>
        /// Registers a style setting for this instance.
        /// </summary>
        /// <param name="setting"></param>
        internal ValueUpdateResult AddStylePropertySetting(IPropertySetting setting)
        {
            RadPropertyValue propVal = this.propertyValues.GetEntry(setting.Property, true);

            return(this.SetValueCore(propVal, setting, null, ValueSource.Style));
        }