Skip to main content

DiagramControl.DrawingContext Attached Property

Specifies the drawing context of the diagram. This is an attached property.

Namespace: DevExpress.Xpf.Diagram

Assembly: DevExpress.Xpf.Diagram.v24.1.dll

NuGet Package: DevExpress.Wpf.Diagram

Declaration

Returns

Type Description
DiagramDrawingContext

A DiagramDrawingContext enumeration value that specifies the current drawing context of the diagram.

Remarks

Use the DrawingContext property to determine the current drawing context of the DiagramControl.

The following example demonstrates a DiagramControl that displays different captions when the diagram is printed and exported.

<dxdiag:DiagramControl.BackgroundTemplate>
    <DataTemplate>
        <TextBlock Name="text" Text="Canvas"/>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=(dxdiag:DiagramControl.DrawingContext), RelativeSource={RelativeSource Self}}" Value="Print">
                <Setter TargetName="text" Property="Text" Value="Print"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=(dxdiag:DiagramControl.DrawingContext), RelativeSource={RelativeSource Self}}" Value="ExportToImage">
                <Setter TargetName="text" Property="Text" Value="Export"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</dxdiag:DiagramControl.BackgroundTemplate>
See Also