Hi Ethan,
as per your recent solution,it did not work.
I am provoding my code here…
LayerOverlay staticOverlay = (LayerOverlay)Map1.CustomOverlays[“StaticOverLay”];
ShapeFileFeatureLayer shapeFileLayer = (ShapeFileFeatureLayer)staticOverlay.Layers[“ShapeLayer”];
LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"];
InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["HighlightLayer"];
highlightLayer.Open();
highlightLayer.Columns.Add(new FeatureSourceColumn("GovtLand_G"));
shapeFileLayer.Open();
SQLstr = "Select Gut_Number,GovtLand_G From ALL where Village_Na= '" + drpVillage.SelectedItem.Text + "' and (GovtLand_G='Forest' or GovtLand_G='Government')";
dtSQL = shapeFileLayer.QueryTools.ExecuteQuery(SQLstr);
if (dtSQL.Rows.Count > 0)
{
int z = 0;
highlightLayer.InternalFeatures.Clear();
List<string> featureIds = new List<string>();
for (int i = 0; i < dtSQL.Rows.Count; i++)
{
string gutNo = dtSQL.Rows[i]["Gut_Number"].ToString();
bool isIntString = gutNo.All(char.IsDigit);
if (isIntString == true)
featureIds.Add(dtSQL.Rows[i]["Gut_Number"].ToString());
else
{
featureIds.Add(GetNumberOnly(gutNo).ToString());
}
}
Collection<Feature> features = shapeFileLayer.QueryTools.GetFeaturesByIds(featureIds, new string[] { "Village_Na" });
Feature f = new Feature();
f.ColumnValues.Add("GovtLand_G", "Forest");
//feature.ColumnValues.Add("GovtLand_G", "Government");
foreach (Feature feature in features)
{
f = feature;
highlightLayer.InternalFeatures.Add(feature.Id+z, f);
z++;
}
}
shapeFileLayer.Close();
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "GovtLand_G";
valueStyle.ValueItems.Add(new ValueItem("Forest", new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(130, 38, 153, 0)))));
valueStyle.ValueItems.Add(new ValueItem("Government", new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(110, 245, 245, 122)))));
highlightLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
if (highlightLayer.InternalFeatures.Count > 0)
{
highlightLayer.Open();
Map1.CurrentExtent = highlightLayer.GetBoundingBox();
highlightLayer.Close();
}
Thank you,