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


C# FrameworkElement.ChildrenOfType方法代码示例

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


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

示例1: ToggleContainerVisibility

        private void ToggleContainerVisibility(FrameworkElement container, TokenInfo tokenInfo)
        {
            if (container == null || tokenInfo == null)
            {
                return;
            }

            var searchFields = container.ChildrenOfType<TextBlock>();
            if (searchFields == null || searchFields.Count <= 0)
            {
                tokenInfo.Visibility = Visibility.Collapsed;
                return;
            }

            var isFilterContained = false;
            var highlightingForeground = HighlightingForeground;
            var highlightingBackground = this.HighlightingBackground;

            foreach (var field in searchFields)
            {
                if (TokenEditExtensions.GetIsExcludedFromSearch(field))
                {
                    continue;
                }

                // clear any previously applied formatting
                var contentRange = new TextRange(field.ContentStart, field.ContentEnd);
                contentRange.ClearAllProperties();

                var matches = Regex.Matches(field.Text, Filter, RegexOptions.IgnoreCase);
                if (matches.Count == 0)
                {
                    continue;
                }

                isFilterContained = true;
                foreach (Match match in matches)
                {
                    var textRange = field.GetTextRangeFromCharOffset(match.Index, match.Length);
                    textRange.ApplyPropertyValue(TextElement.BackgroundProperty, highlightingBackground);

                    if (highlightingForeground != null)
                    {
                        textRange.ApplyPropertyValue(TextElement.ForegroundProperty, highlightingForeground);
                    }
                }
            }

            tokenInfo.Visibility = isFilterContained ? Visibility.Visible : Visibility.Collapsed;
        }
开发者ID:abdelkarim,项目名称:TokenEdit,代码行数:50,代码来源:TokenEdit.cs

示例2: ConfigurationPanelBehavior

 public ConfigurationPanelBehavior(FrameworkElement layoutRoot, FrameworkElement panel)
 {
     this.layoutRoot = layoutRoot;
     this.controlPanel = panel;
     this.gridView = (from i in layoutRoot.ChildrenOfType<RadGridView>() where i.Name == "radGridView" select i).FirstOrDefault();
     this.externalDetailsBorder = (from i in layoutRoot.ChildrenOfType<Border>() where i.Name == "externalDetailsBorder" select i).FirstOrDefault();
     
     this.CurrentDetailsTemplate = DetailsTemplateChoices.FirstOrDefault();
     this.CurrentInlineDetails = InlineDetailsChoices.FirstOrDefault();
     this.CurrentExternalDetailsPresenter = ExternalDetailsPresenterChoices.FirstOrDefault();
     this.CurrentHorizontalScrollingchoices = HorizontalScrollingChoices.FirstOrDefault();
     
     this.controlPanel.LayoutUpdated += controlPanel_LayoutUpdated;
 }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:14,代码来源:ConfigurationPanelBehavior.cs


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