本文整理汇总了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;
}
示例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;
}