FlashFeature(SelectionSet) Method
Flash one or more features in the view simultaneously.
Flash selected features
public Task FlashSelectedFeaturesAsync()
{
return QueuedTask.Run(() =>
{
//Get the active map view.
var mapView = MapView.Active;
if (mapView == null)
return;
//Get the selected features from the map and filter out the standalone table selection.
//At 2.x
//var selectedFeatures = mapView.Map.GetSelection()
// .Where(kvp => kvp.Key is BasicFeatureLayer)
// .ToDictionary(kvp => (BasicFeatureLayer)kvp.Key, kvp => kvp.Value);
////Flash the collection of features.
//mapView.FlashFeature(selectedFeatures);
var selectedFeatures = mapView.Map.GetSelection();
//Flash the collection of features.
mapView.FlashFeature(selectedFeatures);
});
}
Create a tool to identify the features that intersect the sketch geometry
internal class CustomIdentify : MapTool
{
public CustomIdentify()
{
IsSketchTool = true;
SketchType = SketchGeometryType.Rectangle;
//To perform a interactive selection or identify in 3D or 2D, sketch must be created in screen coordinates.
SketchOutputMode = SketchOutputMode.Screen;
}
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
{
return QueuedTask.Run(() =>
{
var mapView = MapView.Active;
if (mapView == null)
return true;
//Get all the features that intersect the sketch geometry and flash them in the view.
var results = mapView.GetFeatures(geometry);
mapView.FlashFeature(results);
var debug = String.Join("\n", results.ToDictionary()
.Select(kvp => String.Format("{0}: {1}", kvp.Key.Name, kvp.Value.Count())));
System.Diagnostics.Debug.WriteLine(debug);
return true;
});
}
}
Target Platforms: Windows 11, Windows 10, Windows 8.1
ArcGIS Pro version: 3.0 or higher.