Back to Devexpress

MapEditor.MapItemEditing Event

wpf-devexpress-dot-xpf-dot-map-dot-mapeditor-258fc1e0.md

latest3.0 KB
Original Source

MapEditor.MapItemEditing Event

Occurs when a user stars to edit a map item.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public event MapItemEditingEventHandler MapItemEditing
vb
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.
ItemsReturns the items to be displayed on a map.
ResultGets or sets the edit action result.

Remarks

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

xaml
<dxm:MapControl x:Name="mapControl">
    <dxm:MapControl.MapEditor>
        <dxm:MapEditor x:Name="mapEditor" MapItemEditing="OnMapItemEditing">
            <dxm:MapEditor.EditorPanelOptions>
                <dxm:MapEditorPanelOptions Visible="True"/>
            </dxm:MapEditor.EditorPanelOptions>
        </dxm:MapEditor>
    </dxm:MapControl.MapEditor>
    <!--. . .-->
</dxm:MapControl>
csharp
private void OnMapItemEditing(object sender, MapItemEditingEventArgs e) {
    if (((MapEditor)sender).Mode is MapEditorCreateMode ) {
        EditableItemHitInfo info = (EditableItemHitInfo)e.AdditionalInfo;
        if (info.Item is MapPath && info.Item.GetContours()[0].Points.Count + 1 > 10)
            e.Result = MapEditActionResult.Finish;
    }
}
vb
Private Sub OnMapItemEditing(ByVal sender As Object, ByVal e As MapItemEditingEventArgs)
    If TypeOf (CType(sender, MapEditor)).Mode Is MapEditorCreateMode 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 Sub

See Also

MapEditor Class

MapEditor Members

DevExpress.Xpf.Map Namespace