Exemplo n.º 1
0
        protected override bool CanSelectOverride(RadObject element)
        {
            IStylableNode stylableNode = element as IStylableNode;

            if (stylableNode != null && element != null)
            {
                return((object)this.elementType == (object)stylableNode.GetThemeEffectiveType());
            }
            return(false);
        }
Exemplo n.º 2
0
        public virtual bool IsCompatible(RadObject element)
        {
            IStylableNode stylableNode = element as IStylableNode;

            if (stylableNode == null)
            {
                return(false);
            }
            if (this.type == ElementSelectorTypes.VisualStateSelector)
            {
                IStylableElement stylableElement = element as IStylableElement;
                string           str             = stylableElement != null ? stylableElement.ThemeRole : element.GetType().Name;
                if (this.value.StartsWith(str))
                {
                    return(true);
                }
                return(str == this.value);
            }
            if (this.type == ElementSelectorTypes.ClassSelector)
            {
                if (this.childSelector == null || this.childSelector.Type != ElementSelectorTypes.VisualStateSelector)
                {
                    return(stylableNode.Class == this.value);
                }
                if (this.childSelector.IsCompatible(element))
                {
                    for (IStylableNode parent = stylableNode.Parent; parent != null; parent = parent.Parent)
                    {
                        if (parent.Class == this.value)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            if (this.type != ElementSelectorTypes.TypeSelector)
            {
                return(false);
            }
            if (this.childSelector == null || this.childSelector.Type != ElementSelectorTypes.VisualStateSelector || !this.childSelector.IsCompatible(element))
            {
                return(stylableNode.GetThemeEffectiveType().FullName == this.value);
            }
            for (IStylableNode parent = stylableNode.Parent; parent != null; parent = parent.Parent)
            {
                if (parent.GetThemeEffectiveType().FullName == this.value)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 3
0
        public virtual bool IsValid(RadObject testElement, string state)
        {
            IStylableNode stylableNode = testElement as IStylableNode;

            if (this.type == ElementSelectorTypes.VisualStateSelector)
            {
                return(string.CompareOrdinal(state, this.Value) == 0);
            }
            if (this.childSelector != null && this.childSelector.Type == ElementSelectorTypes.VisualStateSelector)
            {
                return(this.childSelector.IsValid(testElement, state));
            }
            if (this.type == ElementSelectorTypes.ClassSelector)
            {
                return(string.CompareOrdinal(this.value, stylableNode.Class) == 0);
            }
            if (this.type == ElementSelectorTypes.TypeSelector)
            {
                return(string.CompareOrdinal(this.value, stylableNode.GetThemeEffectiveType().FullName) == 0);
            }
            return(false);
        }