Hi Anandha,
To select features from particular layer set Tool property UseSnapping to true. Then switch off snapping on all map layers except layer you need. In sample all snappable layers are separated by ";" in the input string.
public static async Task ConfigureSnappingAsync(string sLayerNames)
{
// General Snapping
Snapping.IsEnabled = true;
Snapping.SetSnapMode(SnapMode.Point, true);
// Snapping on any point Feature Layers
var flayers = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().ToList();
if (flayers.Count() > 0)
{
//GetDefinition and SetDefinition must be called inside QueuedTask
await QueuedTask.Run(() => {
string sNames = string.Empty;
if (!string.IsNullOrEmpty(sLayerNames))
{
sNames = sLayerNames.ToUpper();
}
foreach (var fl in flayers)
{
var layerDef = fl.GetDefinition() as CIMGeoFeatureLayerBase;
if (string.IsNullOrEmpty(sNames))
{
if (!layerDef.Snappable)
{
layerDef.Snappable = true;
fl.SetDefinition(layerDef);
}
}
else
{
string searchName = fl.Name.ToUpper() + ";";
layerDef.Snappable = sNames.Contains(searchName);
fl.SetDefinition(layerDef);
}
}
});
}
}
The next step is more complicated. There are two ways:
1. Control mouse cursor (set direction you want)
2. Change cursor icon on mouse move then user selects wrong direction and do not accept wrong position on mouse down.