i am programming in wpf.i have to scroll one page up when highlighted word move from viewportHeight.So i am using the below code.it works fine.
FrameworkContentElement fce = (textRange.Start.Parent as FrameworkContentElement);
if (fce != null)
{
fce.BringIntoView();
}
But after i need to use the below code for highlight word.
TextRange fullRange = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
fullRange.ClearAllProperties();
TextPointer start = fullRange.Start.GetPositionAtOffset(offset);
TextPointer end = start.GetPositionAtOffset(length);
TextRange textRange = rtb.Selection;
textRange.Select(start, end);
textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(m_DehighlightbackgroundColor));
textRange.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(m_DehighlightforegroundColor));
After i used fullRange.ClearAllProperties();
the fce.BringIntoView();
not working.I mean not scroll to highlighted word.
So,how to solve this issue?
Regards Arjun