wpf-devexpress-dot-xpf-dot-diagram-dot-diagramitem.md
Gets or sets the coordinates of the item’s upper left corner. This is a dependency property.
Namespace : DevExpress.Xpf.Diagram
Assembly : DevExpress.Xpf.Diagram.v25.2.dll
NuGet Package : DevExpress.Wpf.Diagram
[CustomAction(typeof(ActionAffectsConnectorsRouting))]
public Point Position { get; set; }
<CustomAction(GetType(ActionAffectsConnectorsRouting))>
Public Property Position As Point
| Type | Description |
|---|---|
| Point |
The coordinates of the item’s upper left corner.
|
For items within a container, the Position property specifies the coordinates of the item’s upper left corner relative to the container.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Position 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.
<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">
<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">
<dxdiag:DiagramImage Anchors="All" Angle="0" CanSnapToThisItem="False" CanResize="False" CanCopyWithoutParent="False" CanMove="False" CanSnapToOtherItems="False" CanSelect="False" CanRotate="False" CanCopy="False" Height="190" Position="0,0" StretchMode="UniformToFill" ThemeStyleId="ShapeId.Balanced5" Width="142">
wpf-diagram-custom-context-menu/CS/WpfApp7/MainWindow.xaml#L18
<dxdiag:DiagramShape Height="75"
Position="120,150"
Width="100"/>
wpf-diagram-bind-item-positions-to-source-objects/CS/dxSample/MainWindow.xaml#L34
Anchors="Left, Top"
Position="90,60"
Shape="BasicShapes.Rectangle">
wpf-diagram-change-connection-points/CS/MainWindow.xaml#L18
Height="100"
Position="300,200" />
<dxdiag:DiagramDesignerControl.Actions>
wpf-diagram-proportionally-resize-shapes-within-container/CS/WpfApp13/MainWindow.xaml.cs#L36
var containingRect = customContainer.Items.Select(x => x.RotatedDiagramBounds().BoundedRect()).Aggregate(Rect.Empty, Rect.Union);
customContainer.Position = new Point(containingRect.X, containingRect.Y);
customContainer.Width = (float)containingRect.Width;
wpf-diagram-create-rotatable-containers-with-shapes/CS/WpfApp13/MainWindow.xaml.cs#L45
var containingRect = container.Items.Select(x => x.RotatedDiagramBounds().BoundedRect()).Aggregate(Rect.Empty, Rect.Union);
container.Position = new Point(containingRect.X, containingRect.Y);
container.Width = (float)containingRect.Width;
child.Anchors = child.Anchors Or Sides.Left Or Sides.Right
child.Position = New Point(0.0, AssociatedObject.Height - padding.Top - padding.Bottom)
AssociatedObject.Height += Math.Max(child.MinHeight,If(Double.IsNaN(child.Height), child.ActualHeight, child.Height))
wpf-diagram-proportionally-resize-shapes-within-container/VB/WpfApp13/MainWindow.xaml.vb#L38
Dim containingRect = customContainer.Items.[Select](Function(x) x.RotatedDiagramBounds().BoundedRect()).Aggregate(Rect.Empty, New System.Func(Of Rect, Rect, Rect)(AddressOf Rect.Union))
customContainer.Position = New Point(containingRect.X, containingRect.Y)
customContainer.Width = CSng(containingRect.Width)
wpf-diagram-create-rotatable-containers-with-shapes/VB/WpfApp13/MainWindow.xaml.vb#L50
Dim containingRect = container.Items.[Select](Function(x) x.RotatedDiagramBounds().BoundedRect()).Aggregate(Rect.Empty, New System.Func(Of Rect, Rect, Rect)(AddressOf Rect.Union))
container.Position = New Point(containingRect.X, containingRect.Y)
container.Width = CSng(containingRect.Width)
See Also