Back to Devexpress

DiagramControl.CanvasSizeMode Property

wpf-devexpress-dot-xpf-dot-diagram-dot-diagramcontrol-21cdbe59.md

latest4.7 KB
Original Source

DiagramControl.CanvasSizeMode Property

Specifies whether the Canvas size is automatically changed to fit the current shapes layout. This is a dependency property.

Namespace : DevExpress.Xpf.Diagram

Assembly : DevExpress.Xpf.Diagram.v25.2.dll

NuGet Package : DevExpress.Wpf.Diagram

Declaration

csharp
public CanvasSizeMode CanvasSizeMode { get; set; }
vb
Public Property CanvasSizeMode As CanvasSizeMode

Property Value

TypeDescription
CanvasSizeMode

A CanvasSizeMode enumeration value.

|

Available values:

NameDescription
None

The canvas size does not change on moving shapes outside of it.

| | AutoSize |

The canvas is automatically resized to fit the current shapes layout.

| | Fill |

The canvas fills the entire visible area.

|

Remarks

If the CanvasSizeMode property is set to CanvasSizeMode.AutoSize, the canvas size is automatically changed to fit the current shape layout.

The canvas consists of tiles. The size of a tile is specified by the DiagramControl.PageSize property, e.g., if the end-user places a shape outside of its current borders and the CanvasSizeMode option is set to CanvasSizeMode.AutoSize, the canvas is expanded in the corresponding direction by one additional tile.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CanvasSizeMode 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-diagram-use-diagramdatabindingbehavior-to-generate-diagram-from-collection/CS/DiagramDataBindingBehavior/MainWindow.xaml#L11

xml
<Grid>
    <dxdiag:DiagramControl ShowGrid="False" ShowRulers="False" ShowPageBreaks="False" CanvasSizeMode="Fill" >
        <dxmvvm:Interaction.Behaviors>

wpf-diagram-use-diagramorgchartbehavior-to-generate-diagram-from-collection/CS/OrgChartBindingExample/MainWindow.xaml#L16

xml
<dxdiag:DiagramOrgChartBehavior.TemplateDiagram>
    <dxdiag:DiagramControl CanvasSizeMode="Fill" SelectedStencils="TemplateDesigner, BasicShapes" ShowPageBreaks="false" ShowRulers="false" ShowGrid="false">
        <dxdiag:DiagramContainer Anchors="Left, Top" CanCopyWithoutParent="True" ConnectionPoints="0.5,0 1,0.5 0.5,1 0,0.5" CanAddItems="False" DragMode="ByAnyPoint" Height="190" ItemsCanChangeParent="False" ItemsCanAttachConnectorEndPoint="False" ItemsCanAttachConnectorBeginPoint="False" ItemsCanSelect="False" ItemsCanEdit="False" ItemsCanCopyWithoutParent="False" ItemsCanMove="False" ItemsCanRotate="False" ItemsCanSnapToOtherItems="False" ItemsCanDeleteWithoutParent="False" ItemsCanSnapToThisItem="False" ItemsCanResize="False" Padding="1" Position="-25,150" Shape="StandardContainers.Plain" ThemeStyleId="ShapeId.Moderate5" Width="322">

wpf-diagram-bind-item-positions-to-source-objects/CS/dxSample/MainWindow.xaml#L27

xml
<dxdiag:DiagramControl
    CanvasSizeMode="Fill"
    SelectedStencils="TemplateDesigner, BasicShapes"

See Also

DiagramControl Class

DiagramControl Members

DevExpress.Xpf.Diagram Namespace