コード例 #1
0
        public void Apply(RadObject radObject, bool initializing)
        {
            IStylableElement stylable = radObject as IStylableElement;

            if (stylable != null)
            {
                if (!this.ApplySimpleSettings(stylable))
                {
                    this.ApplyVisualStateSettings(stylable, initializing);
                }
            }
            else
            {
                IStylableNode stylableNode = radObject as IStylableNode;
                if (stylableNode != null)
                {
                    foreach (PropertySettingGroup setting in this.settings)
                    {
                        if (setting.Selector == null || setting.Selector.IsCompatible(radObject))
                        {
                            stylableNode.ApplySettings(setting);
                        }
                    }
                }
            }
            if (!(radObject is RadItem))
            {
                return;
            }
            ((RadItem)radObject).ApplyThemeSettingsOverride();
        }
コード例 #2
0
 public void ApplyValue(IStylableNode element)
 {
     element.ApplySettings(new PropertySettingGroup()
     {
         PropertySettings =
         {
             this.propertySetting
         }
     });
 }
コード例 #3
0
        private void ApplyStyleCore(
            RadObject element,
            StyleGroup styleGroup,
            RadObject stopElement,
            bool recursive)
        {
            IStylableElement stylableElement = element as IStylableElement;
            IStylableNode    stylableNode1   = element as IStylableNode;
            bool             flag1           = stylableElement != null;
            RadItem          radItem         = element as RadItem;
            RadElement       radElement      = element as RadElement;

            if (radItem != null)
            {
                flag1 = radItem.CanHaveOwnStyle;
            }
            else if (radElement != null)
            {
                flag1 = !string.IsNullOrEmpty(radElement.Class);
            }
            if (flag1)
            {
                StyleSheet styleSheet = (StyleSheet)null;
                RadControl control    = this.Control as RadControl;
                if (control != null)
                {
                    styleGroup = control.ResolveStyleGroupForElement(styleGroup, element);
                }
                if (styleGroup != null)
                {
                    styleSheet = styleGroup.CreateStyleSheet(element);
                }
                if (styleSheet == null)
                {
                    StyleGroup styleGroup1 = this.theme.FindStyleGroup(stylableNode1);
                    if (styleGroup1 == null)
                    {
                        for (IStylableNode parent = stylableNode1.Parent; parent != null && styleGroup1 == null && parent != stopElement; parent = parent.Parent)
                        {
                            if (parent.Style != null)
                            {
                                bool flag2 = false;
                                foreach (PropertySettingGroup propertySettingGroup in parent.Style.PropertySettingGroups)
                                {
                                    if (propertySettingGroup.Selector != null && propertySettingGroup.Selector.Type != ElementSelectorTypes.VisualStateSelector && (propertySettingGroup.Selector.ChildSelector != null && propertySettingGroup.Selector.ChildSelector.Type != ElementSelectorTypes.VisualStateSelector) && (propertySettingGroup.Selector.IsCompatible(parent as RadObject) && propertySettingGroup.Selector.ChildSelector.IsCompatible(element)))
                                    {
                                        stylableNode1.ApplySettings(propertySettingGroup);
                                        flag2 = true;
                                        break;
                                    }
                                }
                                if (flag2)
                                {
                                    break;
                                }
                            }
                            styleGroup1 = this.theme.FindStyleGroup(parent);
                        }
                    }
                    if (styleGroup1 != null)
                    {
                        styleSheet = styleGroup1.CreateStyleSheet(element);
                        styleGroup = styleGroup1;
                    }
                }
                if (styleSheet == null && stylableElement != null && stylableElement.FallbackToDefaultTheme)
                {
                    styleGroup = ThemeRepository.ControlDefault.FindStyleGroup((IStylableNode)stylableElement);
                    if (styleGroup != null)
                    {
                        styleSheet = styleGroup.CreateStyleSheet(element);
                    }
                }
                if (radElement != null)
                {
                    if (radElement.GetValueSource(RadElement.StyleProperty) != ValueSource.Local || radElement.Style == null)
                    {
                        int num = (int)radElement.SetDefaultValueOverride(RadElement.StyleProperty, (object)styleSheet);
                    }
                }
                else
                {
                    stylableNode1.Style = styleSheet;
                }
                if (radElement != null)
                {
                    radElement.styleVersion = this.styleVersion;
                }
            }
            if (!recursive)
            {
                return;
            }
            IStylableNode stylableNode2 = element as IStylableNode;

            if (stylableNode2 == null)
            {
                return;
            }
            if (radElement == null || stylableElement != null && stylableElement.FallbackToDefaultTheme)
            {
                stopElement = element;
            }
            foreach (RadObject child in stylableNode2.Children)
            {
                this.ApplyStyleCore(child, styleGroup, stopElement, recursive);
            }
        }