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


C# Element.QuerySelectorAll方法代码示例

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


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

示例1: DisposeBehaviors

        /// <summary>
        /// Disposes and detaches behaviors attached to the specified element and optionally
        /// to contained elements.
        /// </summary>
        /// <param name="element">The element to detach behaviors from.</param>
        /// <param name="recursive">Whether to recursively detach behaviors from contained elements.</param>
        public static void DisposeBehaviors(Element element, bool recursive)
        {
            Debug.Assert(element != null);

            // TODO: Fix Script.Web
            if ((bool)Type.InvokeMethod(element, "hasAttribute", Behavior.BehaviorsAttribute)) {
                DetachBehaviors(element);
            }

            if (recursive) {
                ElementCollection elements = element.QuerySelectorAll(Behavior.BehaviorsSelector);
                int matchingElements = elements.Length;

                if (matchingElements != 0) {
                    for (int i = 0; i < matchingElements; i++) {
                        DetachBehaviors(elements[i]);
                    }
                }
            }
        }
开发者ID:noodlefrenzy,项目名称:scriptsharp,代码行数:26,代码来源:Behavior.cs

示例2: DeactivateFragment

        /// <summary>
        /// Deactivates the specified element and its children by disposing any
        /// behaviors or binding instances attached to the elements.
        /// </summary>
        /// <param name="element">The element to deactivate.</param>
        /// <param name="contentOnly">Whether the element should be deactivated, or only its contained content.</param>
        public void DeactivateFragment(Element element, bool contentOnly)
        {
            Debug.Assert(element != null);

            // Detach behaviors associated with the element and the contained elements.
            if ((contentOnly == false) && element.HasAttribute(Application.BehaviorsAttribute)) {
                DetachBehaviors(element);
            }

            ElementCollection elements = element.QuerySelectorAll(Application.BehaviorsSelector);
            int matchingElements = elements.Length;

            if (matchingElements != 0) {
                for (int i = 0; i < matchingElements; i++) {
                    DetachBehaviors(elements[i]);
                }
            }
        }
开发者ID:nikhilk,项目名称:sharpen,代码行数:24,代码来源:Application.cs

示例3: SetupBehaviors

        /// <summary>
        /// Attaches behaviors associated declaratively with the specified element and optionally
        /// to contained elements.
        /// </summary>
        /// <param name="element">The element to attach behaviors to.</param>
        /// <param name="recursive">Whether to recursively attach behaviors from contained elements.</param>
        public static void SetupBehaviors(Element element, bool recursive)
        {
            Debug.Assert(element != null);

            if (element.HasAttribute(Behavior.BehaviorsAttribute)) {
                AttachBehaviors(element);
            }

            if (recursive) {
                ElementCollection elements = element.QuerySelectorAll(Behavior.BehaviorsSelector);
                int matchingElements = elements.Length;

                if (matchingElements != 0) {
                    for (int i = 0; i < matchingElements; i++) {
                        AttachBehaviors(elements[i]);
                    }
                }
            }
        }
开发者ID:noodlefrenzy,项目名称:scriptsharp,代码行数:25,代码来源:Behavior.cs

示例4: ActivateFragment

        public void ActivateFragment(Element element, bool contentOnly, object model)
        {
            Debug.Assert(element != null);

            if (element == Document.Body) {
                // Perform app-level activation (tied to body initialization)

                // Setup top-level services specified declaratively.
                SetupServices();

                // Create the model declaratively associated with the application.
                if (model == null) {
                    string modelTypeName = (string)Document.Body.GetAttribute(ModelTypeAttribute);
                    if (String.IsNullOrEmpty(modelTypeName) == false) {
                        Type modelType = Type.GetType(modelTypeName);
                        Debug.Assert(modelType != null, "Could not resolve model '" + modelTypeName + "'");

                        model = GetObject(modelType);

                        IInitializable initializableModel = model as IInitializable;
                        if (initializableModel != null) {
                            Dictionary<string, object> modelData = OptionsParser.GetOptions(element, "model");
                            initializableModel.BeginInitialization(modelData);
                            initializableModel.EndInitialization();
                        }
                    }
                }

                _model = model;
            }

            // Create expressions and bindings associated with the specified elements and
            // the contained elements. Do this first, as this allows behaviors to look at
            // values set as a result of bindings when they are attached.
            if ((contentOnly == false) && element.HasAttribute(Application.BindingsAttribute)) {
                SetupBindings(element, model);
            }

            ElementCollection boundElements = element.QuerySelectorAll(Application.BindingsSelector);
            for (int i = 0, boundElementCount = boundElements.Length; i < boundElementCount; i++) {
                SetupBindings(boundElements[i], model);
            }

            // Attach behaviors associated declaratively with the specified element and the
            // contained elements.
            if ((contentOnly == false) && element.HasAttribute(Application.BehaviorsAttribute)) {
                AttachBehaviors(element);
            }

            ElementCollection extendedElements = element.QuerySelectorAll(Application.BehaviorsSelector);
            for (int i = 0, extendedElementCount = extendedElements.Length; i < extendedElementCount; i++) {
                AttachBehaviors(extendedElements[i]);
            }
        }
开发者ID:nikhilk,项目名称:sharpen,代码行数:54,代码来源:Application.cs


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