Have this bit of code which works fine if PolygonLayer property has a FeatureSelection as Selection. but does not highlight the features on the map when Selection property is of type IndexSelection.
What am I doing wrong?
Thanks
What am I doing wrong?
Thanks
public void HighlightFeature(IFeature feature)
{
if (_ignoreSelectionChanged) return;
_ignoreSelectionChanged = true;
if (FeatureSet.AttributesPopulated)
{
//manage selection using the Selection property
FeatureSelection sel = PolygonLayer.Selection as FeatureSelection;
if (sel != null)
{
sel.Clear();
sel.Add(feature);
}
else if (PolygonLayer.Selection is IndexSelection)
{
IndexSelection isel = PolygonLayer.Selection as IndexSelection;
isel.Clear();
isel.Add(feature.Fid);
}
else
{
PolygonLayer.Select(feature.Fid);
}
if (PolygonLayer != null)
{
PolygonLayer.Invalidate();
}
_ignoreSelectionChanged = false;
}
}