Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.2.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