UI⑥Control族控件FlowDocumentScrollViewer

Object->DispatcherObject->DependencyObject->Visual->UIElement->FrameworkElement->Control->FlowDocumentScrollViewer


FlowDocumentScrollViewer

提供一种控件,该控件以连续滚动模式查看流内容。

FlowDocumentScrollViewer以连续滚动模式显示内容。类似的控件FlowDocumentPageViewer可以一次查看页面的方式显示内容。既FlowDocumentPageViewerFlowDocumentScrollViewer被固定到特定的观看模式。另一方面,FlowDocumentReader包含一些功能,使用户可以在各种查看模式之间动态选择(由FlowDocumentReaderViewingMode枚举提供),但代价是要比FlowDocumentPageViewerFlowDocumentScrollViewer重。

下图显示了带有默认用户界面(UI)的FlowDocumentScrollViewer控件。

屏幕快照:基本 FlowDocumentScrollViewer

默认情况下,总是显示垂直滚动条,而水平滚动条则在需要时显示。FlowDocumentScrollViewer  的默认 UI 不包含工具栏; 但是, IsToolBarVisible 属性可用于启用内置工具栏。

FlowDocument的是一个只许子元素FlowDocumentScrollViewer。一个FlowDocumentScrollViewer元素最多可容纳一个FlowDocument

名称备注权限
CanDecreaseZoomProperty标识 CanDecreaseZoom 依赖项属性。public static readonly
CanIncreaseZoomProperty标识 CanDecreaseZoomProperty 依赖项属性。public static readonly
DocumentProperty标识 Document 依赖项属性。public static readonly
HorizontalScrollBarVisibilityProperty标识 HorizontalScrollBarVisibility 依赖项属性。public static readonly
IsInactiveSelectionHighlightEnabledProperty标识 IsInactiveSelectionHighlightEnabled 依赖项属性。public static readonly
IsSelectionActiveProperty标识 IsSelectionActive 依赖项属性。public static readonly
IsSelectionEnabledProperty标识 IsSelectionEnabled 依赖项属性。public static readonly
IsToolBarVisibleProperty标识 IsToolBarVisible 依赖项属性。public static readonly
MaxZoomProperty标识 MaxZoom 依赖项属性。public static readonly
MinZoomProperty标识 MinZoom 依赖项属性。public static readonly
SelectionBrushProperty标识 SelectionBrush 依赖项属性。public static readonly
SelectionOpacityProperty标识 SelectionOpacity 依赖项属性。public static readonly
VerticalScrollBarVisibilityProperty标识 VerticalScrollBarVisibility 依赖项属性。public static readonly
ZoomIncrementProperty标识 ZoomIncrement 依赖项属性。public static readonly
ZoomProperty标识 Zoom 依赖项属性。public static readonly
名称备注权限
CanDecreaseZoom获取一个值,该值指示是否可以降低 Zoom 级别。get;
CanIncreaseZoom获取一个值,该值指示是否可以增加 Zoom 级别。get;
Document获取或设置一个 FlowDocument,它可托管 FlowDocumentScrollViewer 显示的内容。get; set;
HorizontalScrollBarVisibility获取或设置一个值,该值指示是否显示水平滚动条。get; set;
IsInactiveSelectionHighlightEnabled获取或设置指示 FlowDocumentScrollViewer 是否在控件没有焦点时显示所选文本的值。get; set;
IsSelectionActive获取指示 FlowDocumentScrollViewer 是否具有焦点和选择文本的值。get;
IsSelectionEnabled获取或设置一个值,该值指示是否启用 FlowDocumentScrollViewer 中的内容选择。get; set;
IsToolBarVisible获取或设置一个值,该值指示 FlowDocumentScrollViewer 工具栏是否可见。get; set;
LogicalChildren获取一个可循环访问 FlowDocumentScrollViewer 的逻辑子级的枚举器。get;
MaxZoom获取或设置 Zoom 允许的最大 FlowDocumentScrollViewer 级别。get; set;
MinZoom获取或设置 Zoom 允许的最小 FlowDocumentScrollViewer 级别。get; set;
Selection获取 FlowDocumentScrollViewer 的所选内容。get;
SelectionBrush获取或设置用于突出显示选定文本的画笔。get; set;
SelectionOpacity获取或设置 SelectionBrush 的不透明度。get; set;
VerticalScrollBarVisibility获取或设置一个值,该值指示是否显示垂直滚动条。get; set;
Zoom获取或设置当前缩放级别。get; set;
ZoomIncrement获取或设置缩放增量。get; set;
名称备注权限
CancelPrint取消任何当前打印作业。public
DecreaseZoom执行 DecreaseZoom 路由命令。public
Find切换“查找”对话框。public
IncreaseZoom执行 IncreaseZoom 路由命令。public
OnApplyTemplate为 FlowDocumentScrollViewer 构建可视化树。public
OnCancelPrintCommand处理 CancelPrint 路由命令。protected
OnContextMenuOpening每当未处理的 ContextMenuOpening 路由事件在其路由中到达此类时调用。 实现此方法可为此事件添加类处理protected
OnCreateAutomationPeer创建并返回此 AutomationPeer 的 FlowDocumentScrollViewer 对象。protected
OnDecreaseZoomCommand处理 DecreaseZoom 路由命令。protected
OnFindCommand处理 Find 路由命令。protected
OnIncreaseZoomCommand处理 IncreaseZoom 路由命令。protected
OnKeyDown处理 KeyDown 路由事件。protected
OnMouseWheel处理 MouseWheel 路由事件。protected
OnPrintCommand处理 Print 路由命令。protected
OnPrintCompleted完成一个打印作业后调用。protected
Print调用标准的“打印”对话框,此对话框可用于打印 FlowDocumentScrollViewer 的内容和配置打印首选项。public
名称备注
IServiceProvider.GetServiceobject IServiceProvider.GetService (Type serviceType);
IAddChild.AddChildvoid IAddChild.AddChild (object value);
IAddChild.AddTextvoid IAddChild.AddText (string text);


简单范例

<Window x:Class="FlowDocumentScrollViewerDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:FlowDocumentScrollViewerDemo"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <FlowDocumentScrollViewer>
        <FlowDocument Background="LightGreen" FlowDirection="LeftToRight">
            <Paragraph>
                <Bold>
                    FlowDocumentReader是提供一种查看流内容的控件,该控件内置了对多种查看模式的支持。
                </Bold>
            </Paragraph>
            <Paragraph>
                <Bold>
                    FlowDocumentReader具有使用户能够在各种查看模式之间动态选择的功能,包括单页(一次页面)查看模式,一次两页(书本阅读格式)查看模式,以及连续滚动(无底)观看模式。如果您不需要在不同的查看模式之间动态切换的功能,可以使用固定在特定查看模式下的轻量级流内容查看器。 FlowDocumentPageViewer以单页查看模式显示流内容,而FlowDocumentScrollViewer以连续滚动模式显示流内容。有关可用显示模式的更多信息,请参见FlowDocumentReaderViewingMode。
                </Bold>
                <Bold>
                    Content Area -Content Area显示 FlowDocument Document 属性指定的的内容。
                    Tool Bar 工具栏停靠在Content Area的下方。 它承载用于搜索内容、导航页面、选择查看模式和更改缩放级别的控件。
                    Find Button “查找”按钮显示 &quot;查找&quot; 对话框,该对话框允许用户在 FlowDocumentReader 的内容中搜索指定的词或短语。 如果 IsFindEnabled 为false ,则不显示 &quot; 查找 &quot; 按钮。 有关详细信息,请参阅 Find。
                    Page Navigation Controls -页面导航控件包含一个按钮,用于跳转到下一页 (向下箭头) 或上一页 (&quot;向上&quot; 箭头) ,以及当前页码和总页数的指示器。
                    Viewing Mode Buttons -使用查看模式按钮,用户可以从可用的查看模式中进行选择。 有关详细信息,请参阅 ViewingMode。
                    Zoom Controls  -通过单击加号或减号按钮,用户可以使用缩放控件来增加或减少缩放级别。 缩放控件还包括一个用于调整缩放级别的滑块。 有关详细信息,请参阅 Zoom。
                </Bold>
            </Paragraph>
            <Paragraph>
                <Bold>
                    FlowDocumentReader具有使用户能够在各种查看模式之间动态选择的功能,包括单页(一次页面)查看模式,一次两页(书本阅读格式)查看模式,以及连续滚动(无底)观看模式。如果您不需要在不同的查看模式之间动态切换的功能,可以使用固定在特定查看模式下的轻量级流内容查看器。 FlowDocumentPageViewer以单页查看模式显示流内容,而FlowDocumentScrollViewer以连续滚动模式显示流内容。有关可用显示模式的更多信息,请参见FlowDocumentReaderViewingMode。
                </Bold>
            </Paragraph>
            <Paragraph>
                <Bold>
                    Content Area -Content Area显示 FlowDocument Document 属性指定的的内容。
                    Tool Bar 工具栏停靠在Content Area的下方。 它承载用于搜索内容、导航页面、选择查看模式和更改缩放级别的控件。
                    Find Button “查找”按钮显示 &quot;查找&quot; 对话框,该对话框允许用户在 FlowDocumentReader 的内容中搜索指定的词或短语。 如果 IsFindEnabled 为false ,则不显示 &quot; 查找 &quot; 按钮。 有关详细信息,请参阅 Find。
                    Page Navigation Controls -页面导航控件包含一个按钮,用于跳转到下一页 (向下箭头) 或上一页 (&quot;向上&quot; 箭头) ,以及当前页码和总页数的指示器。
                    Viewing Mode Buttons -使用查看模式按钮,用户可以从可用的查看模式中进行选择。 有关详细信息,请参阅 ViewingMode。
                    Zoom Controls  -通过单击加号或减号按钮,用户可以使用缩放控件来增加或减少缩放级别。 缩放控件还包括一个用于调整缩放级别的滑块。 有关详细信息,请参阅 Zoom。
                </Bold>
            </Paragraph>
        </FlowDocument>
    </FlowDocumentScrollViewer>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace FlowDocumentScrollViewerDemo
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值