我正在尝试找到在FlowDocument
窗口内显示 a 的最可扩展的方式 - 只是一个FlowDocument
. 我有:
<FlowDocumentScrollViewer x:Name="message" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
然后在 Window 的构造函数中,我将查看器的 Document 设置为从 XAML 加载的文档(在代码中)。XAML 包含:
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="{x:Null}"
FontSize="12" FontFamily="Segoe UI" PagePadding="2">
<BlockUIContainer>
<BlockUIContainer.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
</BlockUIContainer.Resources>
<StackPanel MaxWidth="200">
<TextBlock Text="{Binding DefinedWord}" FontWeight="Bold" />
<ListBox ItemsSource="{Binding Definitions}"
Style="{StaticResource InvisibleListBox}" Margin="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.CanContentScroll="false">
...
无论我尝试什么,FlowDocumentScrollViewer
都不会滚动,也看不到文档的截断部分。它与 有什么关系BlockUIContainer
,还是我错过了其他东西?