Back to Devexpress

MapEditor.MapItemEditing Event

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

latest3.1 KB
Original Source

MapEditor.MapItemEditing Event

Occurs when a user stars to edit a map item.

Namespace : DevExpress.XtraMap

Assembly : DevExpress.XtraMap.v25.2.dll

NuGet Package : DevExpress.Win.Map

Declaration

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

Event Data

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

PropertyDescription
ActionReturns the action applied to items.
AdditionalInfoReturns additional information about edited items.
EditModeReturns the map edit mode.
ItemsReturns the items to be displayed on a map.
ResultGets or sets the edit action result.

Remarks

The following code shows how to complete the item (a path or a polyline) creation in the Map Editor’s Create mode once the number of vertices reaches 10.

csharp
mapControl.MapEditor.MapItemEditing += OnMapItemEditing;
// . . . 
private void OnMapItemEditing(object sender, MapItemEditingEventArgs e) {
    if (e.EditMode == MapEditMode.Create) {
        EditableItemHitInfo info = (EditableItemHitInfo)e.AdditionalInfo;
        if (info.Item is MapPath && info.Item.GetContours()[0].Points.Count + 1 > 10)
            e.Result = MapEditActionResult.Finish;
    }
}
vb
mapControl.MapEditor.MapItemEditing = (mapControl.MapEditor.MapItemEditing + OnMapItemEditing)
' . . . 
Private Sub OnMapItemEditing(ByVal sender As Object, ByVal e As MapItemEditingEventArgs)
    If (e.EditMode = MapEditMode.Create) Then
        Dim info As EditableItemHitInfo = CType(e.AdditionalInfo,EditableItemHitInfo)
        If (TypeOf info.Item Is (MapPath _
                    AndAlso (info.Item.GetContours(0).Points.Count + (1 > 10)))) Then
            e.Result = MapEditActionResult.Finish
        End If
    End If
End Sub

See Also

MapEditor Class

MapEditor Members

DevExpress.XtraMap Namespace