private Paragraph GetSearchedText() { string sText = MTControler.GetStringText(_LstAnsuer); if (sText == null || _sFragment == null) { return(new Paragraph()); } sText = sText.Replace("[", ""); sText = sText.Replace("]", ""); sText = sText.Replace("'", ""); sText = sText.Replace("\"", ""); sText = sText.Replace(" ", ""); int iStart = sText.ToLower().IndexOf(_sFragment.ToLower()); int iEnd = iStart + _sFragment.Length; Run rStart = new Run(sText.Substring(0, iStart)); Run rMid = new Run(sText.Substring(iStart, iEnd - iStart)); Run rEnd = new Run(sText.Substring(iEnd)); rMid.Background = new SolidColorBrush(Colors.Yellow); Paragraph paragText = new Paragraph(); paragText.Inlines.Add(rStart); paragText.Inlines.Add(rMid); paragText.Inlines.Add(rEnd); paragText.LineHeight = 3; if (paragText != null) { return(paragText); } else { return(new Paragraph()); } }
public void SetLstAdress(List <MTMapModel> lstAdres) { if (_LstAdress != null) { foreach (MTMapModel objMap in _LstAdress) { objMap.RemoveOccurrence(1); } } _LstAdress = lstAdres; _sText = MTControler.GetStringText(_LstAdress); _sAdrees = MTControler.GetAdrees(_LstAdress, false); _sShortAdrees = MTControler.GetAdrees(_LstAdress, true); FirePropertyChanged("Text"); FirePropertyChanged("Adrees"); FirePropertyChanged("AdreesAbrevied"); foreach (MTMapModel objMap in _LstAdress) { objMap.AddOccurrence(1); } }