Use attached to reproduce.
Workaround:
class MyDataCellElement : GridDataCellElement
{
public MyDataCellElement(GridViewColumn col, GridRowElement row) : base(col,row)
{ }
protected override List<CharacterRange> GetSearchHighlightRanges()
{
// return base.GetSearchHighlightRanges();
List<CharacterRange> ranges = new List<CharacterRange>();
if (this.ColumnInfo == null || !this.RowInfo.SearchCache.Contains(this.ColumnInfo))
{
return ranges;
}
string criteria = this.RowInfo.SearchCache[this.ColumnInfo] as string;
int index = -1;
CompareOptions options;
if (this.MasterTemplate.MasterViewInfo.TableSearchRow.CaseSensitive)
{
options = CompareOptions.Ordinal;
}
else
{
options = this.MasterTemplate.MasterViewInfo.TableSearchRow.CompareOptions;
}
do
{
if (index + 1 >= this.Text.Length)
{
break;
}
index = this.MasterTemplate.MasterViewInfo.TableSearchRow.Culture.CompareInfo.IndexOf(this.Text, criteria, index + 1, options);
if (index >= 0)
{
var str = this.Text.Substring(index, criteria.Length);
int symbolCount = 0;
foreach (char ch in str)
{
if (!Char.IsLetterOrDigit(ch))
{
symbolCount++;
}
}
ranges.Add(new CharacterRange(index, criteria.Length + symbolCount));
}
} while (index >= 0 && ranges.Count < 32);
return ranges;
}
}
private void MasterTemplate_CreateCell(object sender, GridViewCreateCellEventArgs e)
{
if (e.CellType == typeof(GridDataCellElement))
{
e.CellElement = new MyDataCellElement(e.Column, e.Row);
}
}