示例#1
0
        public void DeserializePropertySettingGroups(PropertySettingGroupCollection resGroups)
        {
            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                XmlPropertySettingGroup xmlGroup = this.PropertySettingGroups[i];

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

                try
                {
                    PropertySettingGroup group = xmlGroup.Deserialize();
                    resGroups.Add(group);
                }
                catch (Exception ex)
                {
                    string message = "Exception occured while deserializing PropertySettingGroup: " + ex.ToString();
                    Trace.WriteLine(message);
                    Debug.Fail(message);
                }
            }
        }
示例#2
0
        public static void ApplyColorBlendToGroups(PropertySettingGroupCollection groups, HslColor baseColor, string themeParameterName, IPropertiesProvider propertiesProvider)
        {
            foreach (PropertySettingGroup group in groups)
            {
                foreach (IPropertySetting setting in group.PropertySettings)
                {
                    RadProperty prop = setting.Property;
                    if (prop.PropertyType == typeof(Color))
                    {
                        if (setting is AnimatedPropertySetting)
                        {
                            AnimatedPropertySetting animatedSetting = (AnimatedPropertySetting)setting;

                            object value = animatedSetting.StartValue;
                            if (value != null)
                            {
                                Color color = (Color)value;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    object relativeColorDef =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            animatedSetting.GetStartValueProvider());
                                    animatedSetting.StartValue = relativeColorDef;
                                }
                            }

                            object endValue = animatedSetting.EndValue;
                            if (endValue != null)
                            {
                                Color color = (Color)endValue;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    animatedSetting.EndValue =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            animatedSetting.GetEndValueProvider());
                                }
                            }
                        }
                        else //actualSetting is PropertySetting
                        {
                            PropertySetting propertySetting = (PropertySetting)setting;
                            object          value           = propertySetting.Value;
                            if (value != null)
                            {
                                Color color = (Color)value;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    propertySetting.Value =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            propertySetting.GetValueProvider());
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        //public static void ApplyColorBlendToStyle(HslColor baseColor, string themeParameterName, StyleSheet style)
        //{
        //    PropertySettingGroupCollection groups = style.PropertySettingGroups;
        //    ApplyColorBlendToGroups(groups, baseColor, themeParameterName);
        //}

        public void ApplyColorBlendToGroups(PropertySettingGroupCollection groups, HslColor baseColor, string themeParameterName)
        {
            ApplyColorBlendToGroups(groups, baseColor, themeParameterName, this);
        }
示例#4
0
        public static void ApplyColorBlendToStyleSheet(HslColor baseColor, string themeParameterName, IPropertiesProvider propertiesProvider, StyleSheet style)
        {
            PropertySettingGroupCollection groups = style.PropertySettingGroups;

            ApplyColorBlendToGroups(groups, baseColor, themeParameterName, propertiesProvider);
        }