windowsforms-devexpress-dot-xtramap-dot-mapeditor.md
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
[Browsable(false)]
public event MapItemEditedEventHandler MapItemEdited
<Browsable(False)>
Public Event MapItemEdited As MapItemEditedEventHandler
The MapItemEdited event's data class is MapItemEditedEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Action | Returns the action that has been applied to map items. |
| Items | Returns map items to be represented in the map control. Inherited from MapItemsEventArgs. |
You can handle the MapItemEdited event to customize the style of newly created items:
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;
}
}
}
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
mapControl1.MapEditor.ShowEditorPanel = true;
mapControl1.MapEditor.MapItemEdited += MapEditor_MapItemEdited;
}
winforms-map-load-data-from-a-sql-geometry-data-source/VB/SqlGeometry/Form1.vb#L28
Me.mapControl1.MapEditor.ShowEditorPanel = True
AddHandler Me.mapControl1.MapEditor.MapItemEdited, AddressOf Me.MapEditor_MapItemEdited
End Sub
See Also