Ejemplo n.º 1
0
        public ControlStyleBuilderInfo(RadControl previewControl, RadElement theamableRoot, string controlClassName, BuilderRegistrationType builderRegistrationType)
        {
            this.previewControl = previewControl;
            this.theamableRoot  = theamableRoot;

            registration = new XmlStyleBuilderRegistration();
            RadStylesheetRelation relation = new RadStylesheetRelation();

            registration.StylesheetRelations.Add(relation);

            relation.RegistrationType = builderRegistrationType;
            relation.ElementType      = theamableRoot.GetThemeEffectiveType().FullName;
            relation.ControlType      = controlClassName;
        }
Ejemplo n.º 2
0
        public ControlStyleBuilderInfo(RadControl previewControl, RadElement theamableRoot, string mainElementClassName)
        {
            this.previewControl       = previewControl;
            this.theamableRoot        = theamableRoot;
            this.mainElementClassName = mainElementClassName;

            registration = new XmlStyleBuilderRegistration();

            RadStylesheetRelation relation = new RadStylesheetRelation();

            registration.StylesheetRelations.Add(relation);

            relation.RegistrationType = BuilderRegistrationType.ElementTypeControlType;
            relation.ElementType      = theamableRoot.GetThemeEffectiveType().FullName;

            relation.ControlType = theamableRoot.ElementTree.ComponentTreeHandler.ThemeClassName;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attempts to merge the specified style builder registration with our current registrations.
        /// </summary>
        /// <param name="mergeRegistration">The source registration which is to be merged with the default registration
        /// of the metadata.</param>
        /// <param name="themeName"></param>
        /// <returns>The default registration if successfully merged, otherwise null</returns>
        protected internal virtual StyleBuilderRegistration TryMergeRegistration(XmlStyleBuilderRegistration mergeRegistration, string themeName)
        {
            List <StyleBuilderRegistration> allRegistrations = this.StyleBuilderRegistrations;
            StyleSheet mergeStyle = null;

            foreach (StyleBuilderRegistration thisRegistration in allRegistrations)
            {
                bool match = false;

                foreach (RadStylesheetRelation mergeRelation in mergeRegistration.StylesheetRelations)
                {
                    foreach (RadStylesheetRelation thisRelation in thisRegistration.StylesheetRelations)
                    {
                        //our registration matches the provided one
                        if (!mergeRelation.Equals(thisRelation))
                        {
                            continue;
                        }

                        if (mergeStyle == null)
                        {
                            mergeStyle = (mergeRegistration.GetRegistration().Builder as DefaultStyleBuilder).Style;
                        }
                        //merge style and relations
                        (thisRegistration.Builder as DefaultStyleBuilder).Style = mergeStyle;
                        this.AddUniqueRelations(thisRegistration, mergeRegistration.StylesheetRelations, themeName);
                        this.MergeItemStates(mergeStyle);
                        match = true;
                        break;
                    }

                    //match is found for current registration, continue with top-level loop
                    if (match)
                    {
                        return(thisRegistration);
                    }
                }
            }

            return(null);
        }