Back to Devexpress

DocumentViewerControl.ZoomFactor Property

wpf-devexpress-dot-xpf-dot-documentviewer-dot-documentviewercontrol-fc9b1ece.md

latest4.3 KB
Original Source

DocumentViewerControl.ZoomFactor Property

Specifies the current document zoom factor. This is a dependency property.

Namespace : DevExpress.Xpf.DocumentViewer

Assembly : DevExpress.Xpf.DocumentViewer.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.DocumentViewer.Core

Declaration

csharp
public double ZoomFactor { get; set; }
vb
Public Property ZoomFactor As Double

Property Value

TypeDescription
Double

A Double value that specifies the document zoom factor.

|

Remarks

This property affects the ZoomMode property’s behavior. The zoom mode switches to Custom when you specify the ZoomFactor property.

The ZoomFactor property’s default value is 1 (corresponds to 100% ), the minimum value is 0.1 ( 10% ), the maximum value is 5 ( 500% ).

You can use the Document Preview‘s toolbar commands to specify the document zoom factor.

Alternatively, specify this property from code as shown below.

csharp
using DevExpress.Xpf.Printing;
//...
documentPreviewControl.ZoomFactor = 5;
//...
vb
Imports DevExpress.Xpf.Printing
'...
documentPreviewControl.ZoomFactor = 5
'...

You can also specify the ZoomFactor property in XAML.

xaml
<Window
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing">
      ... 
      <dxp:DocumentPreviewControl ZoomFactor="5" />
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the ZoomFactor property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-pdf-viewer-draw-a-rectangle-over-a-document/CS/MainWindow.xaml#L27

xml
Grid.ColumnSpan="2"
ZoomFactor="0.7">
<dxmvvm:Interaction.Behaviors>

wpf-pdf-viewer-replace-standard-command-with-custom-command/CS/MainWindow.xaml.cs#L37

csharp
foreach (var zoomFactor in factors) {
    if (Control.ZoomFactor < zoomFactor) {
        Control.ZoomFactor = zoomFactor;

wpf-pdf-viewer-replace-standard-command-with-custom-command/VB/MainWindow.xaml.vb#L56

vb
For Each zoomFactor In Me.factors
    If Me.Control.ZoomFactor < zoomFactor Then
        Me.Control.ZoomFactor = zoomFactor

See Also

DocumentViewerControl Class

DocumentViewerControl Members

DevExpress.Xpf.DocumentViewer Namespace