簡體   English   中英

FlowDocumentScrollViewer不會滾動

[英]FlowDocumentScrollViewer won't scroll

我正在嘗試找到在窗口內顯示FlowDocument的最可擴展的方法-僅是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有什么關系,還是我缺少其他東西?

我最終被設置得到這個工作ListBox里面的文件,以IsHitTestVisible="false" ,再裝訂Width內部的文本塊的ListBoxItem模板到ActualWidth中的ListBoxItem

帶有流文檔的靈活內容顯示

簡介:FlowDocumentScrollViewer-此控件使用滾動條以連續流方式顯示文檔,類似於Microsoft Word中的網頁或Web布局。

對我來說, FlowDocumentScrollViewer替代選項有效,

請參見http://msdn.microsoft.com/zh-cn/library/system.windows.controls.richtextbox.aspx中的示例

其他選項可以是FlowDocumentPageViewerFlowDocumentReader

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM