Back to Devexpress

DiagramItem.TemplateName Property

wpf-devexpress-dot-xpf-dot-diagram-dot-diagramitem-9a223ada.md

latest4.7 KB
Original Source

DiagramItem.TemplateName Property

Identifies the item as a template used by data binding behaviors. This is a dependency property.

Namespace : DevExpress.Xpf.Diagram

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

NuGet Package : DevExpress.Wpf.Diagram

Declaration

csharp
[Browsable(false)]
public string TemplateName { get; set; }
vb
<Browsable(False)>
Public Property TemplateName As String

Property Value

TypeDescription
String

A string value that is the name of the template.

|

Remarks

By default, the uppermost connector and diagram item defined in XAML within the DiagramDataBindingBehaviorBase.TemplateDiagram are used as templates for the connectors and diagram items representing data objects.

You can use the DiagramDataBindingBehaviorBase.GenerateItem and DiagramDataBindingBehaviorBase.GenerateConnector events to implement custom logic for choosing the item and connector template. To do this, create diagram items/connectors in the DiagramDataBindingBehaviorBase.TemplateDiagram and specify their names using the TemplateName property. Specify the name of the desired template as the event’s CreateItemFromTemplate / CreateConnectorFromTemplate method parameter.

Alternatively, you can use the DiagramDataBindingBehaviorBase.ItemTemplateSelector property.

To learn more, see Item Template Designer.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TemplateName 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#L16

xml
<dxdiag:DiagramControl CanvasSizeMode="Fill" SelectedStencils="TemplateDesigner" ShowPageBreaks="false">
    <dxdiag:DiagramContainer Anchors="Left, Top" Background="#FFCEE1F2" CanCopyWithoutParent="True" ConnectionPoints="0.5,0 1,0.5 0.5,1 0,0.5" CanAddItems="False" DragMode="ByAnyPoint" Height="78" ItemsCanChangeParent="False" ItemsCanAttachConnectorEndPoint="False" ItemsCanAttachConnectorBeginPoint="False" ItemsCanSelect="False" ItemsCanEdit="False" ItemsCanCopyWithoutParent="False" ItemsCanMove="False" ItemsCanRotate="False" ItemsCanSnapToOtherItems="False" ItemsCanDeleteWithoutParent="False" ItemsCanSnapToThisItem="False" ItemsCanResize="False" Position="25,150" StrokeId="Black" Shape="StandardContainers.Alternating" ShowHeader="False" StrokeDashArray="5 3" ThemeStyleId="ShapeId.Focused1" TemplateName="ClassShape" Width="200">
        <dxdiag:DiagramShape Anchors="Left, Top" Angle="0" Background="Transparent" CanAttachConnectorBeginPoint="False" CanResize="False" CanEdit="False" CanCopyWithoutParent="False" CanChangeParent="False" CanMove="False" CanAttachConnectorEndPoint="False" CanSelect="False" CanDeleteWithoutParent="False" CanRotate="False" ForegroundId="Black" FontWeight="Bold" FontFamily="Arial" Height="25" Position="11,10" StrokeThickness="0" ThemeStyleId="Variant2" TextAlignment="Left" Width="176">

See Also

GenerateItem

GenerateConnector

DiagramItem Class

DiagramItem Members

DevExpress.Xpf.Diagram Namespace