开发者

Events with FlowDocumentPageViewer WPF

Needed some help.

  1. Is there are any events while we change the p开发者_Python百科ages in the FlowDocumentPageViewer
  2. is there are any events while we zoomIn/zoomOut in the FlowDocumentPageViewer

Best, Bala.


Are there any events while we change pages in FlowDocumentPageViewer?

Yes. FlowDocumentPageViewer.MasterPage changes values whenever you change pages. Since it is a DP you can just bind your own DP to it, and handle the PropertyChangedCallback on your DP.

Are there any events while we zoom in/out in FlowDocumentPageViewer?

Yes. FlowDocumentPageViewer.Zoom changes values whenever you change the zoom. Since it is a DP you can just bind your own DP to it, and handle the PropertyChangedCallback on your DP.


Example:

<FlowDocumentPageViewer
  Zoom="{Binding MyZoom, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor,MyControl,1}}"
  MasterPage="{Binding MyMasterPage, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor,MyControl,1}}"
  ...

Where MyZoom and MyMasterPage are DependencyProperties defined on MyControl.


For the master page you can handle the PageDisconnected event inside the DocumentPageView in the FlowDocumentPageViewer control template. This event will be raised when the master page is changed. Inside the event handler you can compare the DocumentPageView.PageNumber with your stored page number value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜