Ejemplo n.º 1
0
        private void HighlightTextBlocks()
        {
            this.PrepareHighlightedRunsList();

            IEnumerable <DependencyObject> textBlockDescendands = ElementTreeHelper.EnumVisualDescendants(this, descendand => descendand is TextBlock);

            foreach (TextBlock textBlock in textBlockDescendands)
            {
                if (!RadAutoCompleteBox.GetIsTextMatchHighlightEnabled(textBlock))
                {
                    continue;
                }

                if (this.owner.owner.FilterMode == AutoCompleteBoxFilterMode.StartsWith)
                {
                    this.HighlightStartingMatch(textBlock, this.stringToHighlight, RadAutoCompleteBox.GetTextMatchHighlightStyle(textBlock));
                }
                else
                {
                    this.HighlightAllMatches(textBlock, this.stringToHighlight, RadAutoCompleteBox.GetTextMatchHighlightStyle(textBlock));
                }
            }

            if (this.IsSelected)
            {
                this.ResetRunHighlightedForegroundValue();
            }
        }
        /// <inheritdoc />
        protected override IList <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> list = new List <AutomationPeer>();

            IEnumerable <DependencyObject> childElements = ElementTreeHelper.EnumVisualDescendants(this.Owner, descendand => descendand is ChartElementPresenter);

            foreach (ChartElementPresenter child in childElements)
            {
                AutomationPeer item = FrameworkElementAutomationPeer.FromElement(child);
                if (item == null)
                {
                    item = FrameworkElementAutomationPeer.CreatePeerForElement(child);
                }

                if (item != null)
                {
                    list.Add(item);
                }
            }

            var emptyContentPresenter = ElementTreeHelper.EnumVisualDescendants(this.Owner, descendand => descendand is ContentPresenter)
                                        .Where(presenter => presenter.Equals(this.OwningChart.emptyContentPresenter)).SingleOrDefault() as ContentPresenter;

            if (emptyContentPresenter != null)
            {
                list.Add(FrameworkElementAutomationPeer.CreatePeerForElement(emptyContentPresenter));
            }

            return(list);
        }