B_o*_*old 5 c# wpf scroll richtextbox
WPF RichtTextBox有一个滚动方法:
RichTextBox.ScrollToVerticalOffset(double)
Run Code Online (Sandbox Code Playgroud)
我想以这样的方式滚动,一个cerctain范围或至少它的开始进入视野.如何以有意义的方式将TextPointer转换为double?
看看FrameworkElement.BringIntoView方法.我正在使用这样的东西:
public void Foo(FlowDocumentScrollViewer viewer) {
TextPointer t = viewer.Selection.Start;
FrameworkContentElement e = t.Parent as FrameworkContentElement;
if (e != null)
e.BringIntoView();
}
Run Code Online (Sandbox Code Playgroud)