示例#1
0
        private static void OnKeywordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            HighlightTextBlock htb = d as HighlightTextBlock;

            if (htb != null && string.IsNullOrEmpty(e.NewValue as string)) // 검색 키워드가 지워졌을 경우, 원래 text로 세팅
            {
                htb.Inlines.Clear();
                htb.SetColorOfString(htb.FullText);
                return;
            }

            if (htb.IsEnableMultiHighlight && htb.KeywordList != null && htb.KeywordList.Count > 0)
            {
                htb.SearchMultipleKeywordAndHighlight(htb.KeywordList);
            }
            else
            {
                htb.SearchKeywordAndHighlight((string)e.NewValue);
            }
        }
示例#2
0
        private static void OnFullTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.NewValue as string))
            {
                return;
            }

            HighlightTextBlock htb = d as HighlightTextBlock;

            if (htb != null)
            {
                htb.Inlines.Clear();
                htb.SetColorOfString(e.NewValue as string);
            }

            if (htb.IsEnableMultiHighlight && htb.KeywordList != null && htb.KeywordList.Count > 0)
            {
                htb.SearchMultipleKeywordAndHighlight(htb.KeywordList);
            }
            else if (string.IsNullOrEmpty(htb.Keyword) == false)
            {
                htb.SearchKeywordAndHighlight(htb.Keyword);
            }
        }