Back to Devexpress

MapEditor.MapItemEdited Event

windowsforms-devexpress-dot-xtramap-dot-mapeditor.md

latest4.1 KB
Original Source

MapEditor.MapItemEdited Event

Occurs when the Map Editor is used to add, edit or remove a map item.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

csharp
[Browsable(false)]
public event MapItemEditedEventHandler MapItemEdited
vb
<Browsable(False)>
Public Event MapItemEdited As MapItemEditedEventHandler

Event Data

The MapItemEdited event's data class is MapItemEditedEventArgs. The following properties provide information specific to this event:

PropertyDescription
ActionReturns the action that has been applied to map items.
ItemsReturns map items to be represented in the map control. Inherited from MapItemsEventArgs.

Remarks

You can handle the MapItemEdited event to customize the style of newly created items:

csharp
private void Form1_Load(object sender, EventArgs e) {
    this.mapControl1.MapEditor.MapItemEdited += MapEditor_MapItemEdited;
}

private void MapEditor_MapItemEdited(object sender, MapItemEditedEventArgs e) {
    foreach (MapItem item in e.Items) {
        if (item is MapRectangle) {
            MapRectangle rectangle = (MapRectangle)item;
            rectangle.Fill = Color.FromArgb(128, 0, 255, 0);
            rectangle.Stroke = Color.Yellow;
        }
    }
}
vb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.mapControl1.MapEditor.MapItemEdited += AddressOf MapEditor_MapItemEdited
End Sub

Private Sub MapEditor_MapItemEdited(ByVal sender As Object, ByVal e As MapItemEditedEventArgs)
    For Each item As MapItem In e.Items

        If TypeOf item Is MapRectangle Then
            Dim rectangle As MapRectangle = CType(item, MapRectangle)
            rectangle.Fill = Color.FromArgb(128, 0, 255, 0)
            rectangle.Stroke = Color.Yellow
        End If
    Next
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MapItemEdited event.

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.

winforms-map-load-data-from-a-sql-geometry-data-source/CS/SqlGeometry/Form1.cs#L29

csharp
mapControl1.MapEditor.ShowEditorPanel = true;
    mapControl1.MapEditor.MapItemEdited += MapEditor_MapItemEdited;
}

winforms-map-load-data-from-a-sql-geometry-data-source/VB/SqlGeometry/Form1.vb#L28

vb
Me.mapControl1.MapEditor.ShowEditorPanel = True
    AddHandler Me.mapControl1.MapEditor.MapItemEdited, AddressOf Me.MapEditor_MapItemEdited
End Sub

See Also

MapEditor Class

MapEditor Members

DevExpress.XtraMap Namespace