Skip to main content

DiagramControl.SelectItem(DiagramItem, ModifySelectionMode) Method

Selects the specified diagram item.

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v24.1.dll

NuGet Package: DevExpress.Win.Diagram

Declaration

public void SelectItem(
    DiagramItem item,
    ModifySelectionMode modifySelectionMode = ModifySelectionMode.ReplaceSelection
)

Parameters

Name Type Description
item DiagramItem

A DiagramItem object that is the item to select.

Optional Parameters

Name Type Default Description
modifySelectionMode ModifySelectionMode ReplaceSelection

A ModifySelectionMode enumeration value that specifies whether to add or replace the existing selection with the specified diagram item.

Remarks

The following code sample demonstrates how to use the SelectItem method to select a newly added shape:

private void button1_Click(object sender, EventArgs e) {
    DiagramShape diagramShape = new DiagramShape();
    diagramShape.Shape = BasicFlowchartShapes.Decision;
    diagramShape.Size = new SizeF(200, 200);
    diagramShape.Position = new DevExpress.Utils.PointFloat(450, 300);

    diagramControl1.Items.Add(diagramShape);
    diagramControl1.SelectItem(diagramShape, ModifySelectionMode.ReplaceSelection);
}
See Also