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.SelectionModel Property

Gets an object that represents the currently selected diagram item.

Namespace: DevExpress.Xpf.Diagram

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

NuGet Package: DevExpress.Wpf.Diagram

#Declaration

[Browsable(false)]
public SelectionModel<IDiagramItem> SelectionModel { get; }

#Property Value

Type Description
DevExpress.Diagram.Core.SelectionModel<DevExpress.Diagram.Core.IDiagramItem>

A SelectionModel object.

#Remarks

Use the SelectionModel property to display the properties of the selected diagram item within an external property grid.

The following example demonstrates the PropertyGridControl that allows editing shape properties.

<Window ...
        xmlns:dxdiag="http://schemas.devexpress.com/winfx/2008/xaml/diagram" 
        xmlns:dxprg="http://schemas.devexpress.com/winfx/2008/xaml/propertygrid">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="179"/>
        </Grid.ColumnDefinitions>
        <dxdiag:DiagramControl x:Name="diagramControl" Grid.Column="0" SelectedStencils="BasicShapes, BasicFlowchartShapes">
            <dxdiag:DiagramShape x:Name="diagramShape1" Angle="0" Content="Item1" Height="75" Position="400,350" Shape="BasicShapes.Rectangle" Width="100"/>
            <dxdiag:DiagramConnector BeginItemPointIndex="2" BeginItem="{Binding ElementName=diagramShape1}" EndItemPointIndex="3" EndItem="{Binding ElementName=diagramShape2}" Points="450,442 558,442 558,387.5"/>
            <dxdiag:DiagramShape x:Name="diagramShape2" Angle="0" Content="Item2" Height="75" Position="575,350" Shape="BasicShapes.Rectangle" Width="100"/>
        </dxdiag:DiagramControl>
        <dxprg:PropertyGridControl dxdiag:DiagramControl.Diagram="{Binding ElementName=diagramControl} Grid.Column="1" SelectedObject="{Binding ElementName=diagramControl, Path=SelectionModel}"/>
    </Grid>
</Window>
See Also