从字面上看,我在吠叫错误的树!我的问题的答案是 FlowDocumentReader 是可视树的一部分。我不得不去寻找它。可能有更优雅的方法可以做到这一点,但这个方法有效:
static public void SetReaderModeToScroll(Visual myVisual)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); i++)
{
// fetch the child
Visual childVisual = (Visual)VisualTreeHelper.GetChild(myVisual, i);
// attempt to cast it to a FlowDocumentReader
try
{
FlowDocumentReader reader = (FlowDocumentReader) childVisual;
// if we get this far, we've found the reader
reader.ViewingMode = FlowDocumentReaderViewingMode.Scroll;
return;
}
// catch the exception if it doesn't work
catch (Exception e)
{
}
// Drill down another level and keep looking
SetReaderModeToScroll(childVisual);
}
}