【发布时间】:2016-01-28 04:19:10
【问题描述】:
我想在 wpf richextbox 中上下翻页。我试过了
var start = txtAppendValue.Selection.Start.GetCharacterRect(LogicalDirection.Forward);
var end = txtAppendValue.Selection.End.GetCharacterRect(LogicalDirection.Forward);
txtAppendValue.ScrollToVerticalOffset((start.Top + end.Bottom - txtAppendValue.ViewportHeight) / 2 + txtAppendValue.VerticalOffset);
但它连续滚动每一行开始,如果当前偏移值移动到richtextbox中的不可见区域,我想向上或向下移动页面而不是逐行滚动。
注意:我也试过 BringIntoView();
FrameworkContentElement fce = (textRange.Start.Parent as FrameworkContentElement);
if (fce != null)
{
fce.BringIntoView();
}
在我使用textrange.clearallproperties()之后它不起作用。在此之前它起作用了。
那么,请告诉我如何向上翻页和向下翻页?
问候 巴拉
【问题讨论】:
标签: c# wpf scroll richtextbox