如何从 DevExpress MapControl 中删除项目?

How to remove item from DevExpress MapControl?

我想从 MapControl 中删除所选项目。我愿意:

MapItem t = (MapItem)vectorItemsLayer.SelectedItem;
SqlGeometryItem sourceItem = (SqlGeometryItem)vectorItemsLayer.GetItemSourceObject(t);
sqlGeometryItemStorage.Items.Remove(sourceItem);

并在 GetItemSourceObject 中出错:

Can not cast 'DevExpress.XtraMap.MapPolyline' to 'DevExpress.XtraMap.SqlGeometryItem'

documentation 中,我看到该方法需要 MapItem 和 return SqlGeometryItem

那我还能错过什么?
也许还有更优化的方法从地图中删除项目?

How to get SqlGeometryItem corresponding to MapItem displayed on a map

There is not a way to get SqlGeometryItem corresponding to a specific MapItem right now. The DevExpress support team is investigating this issue and suggest you follow the above support ticket to get the update about the solution of the required functionality.