Ejemplo n.º 1
0
        private void RemoveColorBlendInternal(string themeParameterName)
        {
            foreach (StyleBuilderRegistration registration in this.GetRegisteredStyleBuilders())
            {
                PartiallyLoadableStyleSheet partiallyLoaded =
                    ((DefaultStyleBuilder)registration.Builder).Style as PartiallyLoadableStyleSheet;

                //Partially loaded stylesheets support
                if (partiallyLoaded != null && !partiallyLoaded.IsLoadedCompletely)
                {
                    PartiallyLoadedStyleSheetHelper helper = this.partiallyLoadedHelpers[partiallyLoaded];
                    if (helper != null)
                    {
                        helper.UnsubscribeFromLoadedEvent(partiallyLoaded);
                    }
                    continue;
                }

                foreach (
                    PropertySettingGroup group in
                    ((DefaultStyleBuilder)registration.Builder).Style.PropertySettingGroups)
                {
                    foreach (IPropertySetting setting in group.PropertySettings)
                    {
                        RadProperty prop = setting.Property;
                        if (prop.PropertyType == typeof(Color))
                        {
                            if (setting is AnimatedPropertySetting)
                            {
                                ColorBlendExtension startValueExtension =
                                    ((AnimatedPropertySetting)setting).GetStartValueProvider() as ColorBlendExtension;
                                if (startValueExtension != null && startValueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((AnimatedPropertySetting)setting).StartValue = startValueExtension.OriginalColor;
                                }

                                ColorBlendExtension endValueExtension =
                                    ((AnimatedPropertySetting)setting).GetEndValueProvider() as ColorBlendExtension;
                                if (endValueExtension != null && endValueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((AnimatedPropertySetting)setting).EndValue = endValueExtension.OriginalColor;
                                }
                            }
                            else //actualSetting is PropertySetting
                            {
                                ColorBlendExtension valueExtension =
                                    ((PropertySetting)setting).GetValueProvider() as ColorBlendExtension;
                                if (valueExtension != null && valueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((PropertySetting)setting).Value = valueExtension.OriginalColor;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private static object GetRelativeColorDef(IPropertiesProvider propertiesProvider, string themeParameterName, HslColor baseHslColor, Color currentColor, IValueProvider originalValueProvider)
        {
            ColorBlendExtension extension = originalValueProvider as ColorBlendExtension;

            if (extension == null)
            {
                return(new ColorBlendExtension(propertiesProvider, themeParameterName, baseHslColor, currentColor, currentColor));
            }
            else
            {
                return(new ColorBlendExtension(propertiesProvider, themeParameterName, baseHslColor, currentColor, extension.OriginalColor));
            }
        }