This document is archived and information here might be outdated. Recommended version. |
Clear the selected features in the IActiveView for a specified IFeatureLayer.
///<summary>Clear the selected features in the IActiveView for a specified IFeatureLayer.</summary> /// ///<param name="activeView">An IActiveView interface</param> ///<param name="featureLayer">An IFeatureLayer</param> /// ///<remarks></remarks> public void ClearSelectedMapFeatures(ESRI.ArcGIS.Carto.IActiveView activeView, ESRI.ArcGIS.Carto.IFeatureLayer featureLayer) { if(activeView == null || featureLayer == null) { return; } ESRI.ArcGIS.Carto.IFeatureSelection featureSelection=featureLayer as ESRI.ArcGIS.Carto.IFeatureSelection; // Dynamic Cast // Invalidate only the selection cache. Flag the original selection activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null); // Clear the selection featureSelection.Clear(); // Flag the new selection activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, null, null); }
'''<summary>Clear the selected features in the IActiveView for a specified IFeatureLayer.</summary> ''' '''<param name="activeView">An IActiveView interface</param> '''<param name="featureLayer">An IFeatureLayer</param> ''' '''<remarks></remarks> Public Sub ClearSelectedMapFeatures(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal featureLayer As ESRI.ArcGIS.Carto.IFeatureLayer) If activeView Is Nothing OrElse featureLayer Is Nothing Then Return End If Dim featureSelection As ESRI.ArcGIS.Carto.IFeatureSelection=TryCast(featureLayer, ESRI.ArcGIS.Carto.IFeatureSelection) ' Dynamic Cast ' Invalidate only the selection cache. Flag the original selection activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) ' Clear the selection featureSelection.Clear() ' Flag the new selection activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection, Nothing, Nothing) End Sub