当前位置: 首页>>代码示例>>C#>>正文


C# UIElement.ClearStyledValues方法代码示例

本文整理汇总了C#中UIElement.ClearStyledValues方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.ClearStyledValues方法的具体用法?C# UIElement.ClearStyledValues怎么用?C# UIElement.ClearStyledValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIElement的用法示例。


在下文中一共展示了UIElement.ClearStyledValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyStylesInternal

        /// <summary>
        /// Applies styles to the specified element.
        /// </summary>
        /// <param name="element">The element to which to apply styles.</param>
        private void ApplyStylesInternal(UIElement element)
        {
            element.ClearStyledValues(false);

            // Gather styles from document
            var selector = default(UvssSelector);
            foreach (var rule in rules)
            {
                if (!rule.MatchesElement(element, out selector))
                    continue;

                var uv = element.Ultraviolet;
                var navexp = NavigationExpression.FromUvssNavigationExpression(uv, rule.NavigationExpression);

                foreach (var style in rule.Styles)
                {
                    prioritizer.Add(uv, selector, navexp, style);
                }

                foreach (var trigger in rule.Triggers)
                {
                    prioritizer.Add(uv, selector, navexp, trigger);
                }
            }

            // Apply styles to element
            prioritizer.Apply(element);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:32,代码来源:UvssDocument.cs

示例2: ApplyStylesInternal

        /// <summary>
        /// Applies styles to the specified element.
        /// </summary>
        /// <param name="element">The element to which to apply styles.</param>
        private void ApplyStylesInternal(UIElement element)
        {
            element.ClearStyledValues(false);

            // Prioritize styles from name.
            var frameworkElement = element as FrameworkElement;
            if (frameworkElement != null && !String.IsNullOrEmpty(frameworkElement.Name))
            {
                var ruleSetsByName = GetRuleSetsByName(frameworkElement.Name, onlyIfExists: true);
                if (ruleSetsByName != null)
                {
                    foreach (var categorized in ruleSetsByName)
                        AddRuleSetToPrioritizer(element, categorized.Selector, categorized.RuleSet, categorized.Index);
                }
            }

            // Prioritize styles from class.
            foreach (var @class in element.Classes)
            {
                var ruleSetsByCategory = GetRuleSetsByClass(@class, onlyIfExists: true);
                if (ruleSetsByCategory != null)
                {
                    foreach (var categorized in ruleSetsByCategory)
                        AddRuleSetToPrioritizer(element, categorized.Selector, categorized.RuleSet, categorized.Index);
                }
            }

            // Prioritize rules from type.
            var ruleSetsByType = GetRuleSetsByType(element.UvmlName, onlyIfExists: true);
            if (ruleSetsByType != null)
            {
                foreach (var categorized in ruleSetsByType)
                    AddRuleSetToPrioritizer(element, categorized.Selector, categorized.RuleSet, categorized.Index);
            }

            // Prioritize uncategorized styles.
            foreach (var categorized in ruleSetsWithoutCategory)
                AddRuleSetToPrioritizer(element, categorized.Selector, categorized.RuleSet, categorized.Index);

            // Apply styles to element
            prioritizer.Apply(element);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:46,代码来源:UvssDocument.cs


注:本文中的UIElement.ClearStyledValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。