Hi,
I’ve loaded a Shape File Feature Layer to Map Control. Is it possible to change each polygon’s style (BackColor, Border, …)?
I can set style for the whole layer, but i want each polygon has its own style. for example after loading the layer, i want to select some random polygons and change their back color to green.
thanks.
Change a polygon back color
Hi Mehdi,
Thanks for evaluating our products and welcome to Map Suite Forums!
Yes, it's possible. we can use the Value Style to set the specified polygon’s
style based on its columns value, More detail about value style please check the sample DrawFeaturesBasedOnAvaue under Styles category of the HowDoI
sample. In your case, I guess we need one more layer like InmemoryFeatureLayer
to contain those polygons
I also created a simple “Post11405.zip” for you based your
example. Please have a look to see if it is fit for you.
If more queries, please feel free to let us know.
Thanks,
Johnny
Post11405.zip (1.75 MB)
Hi Johnny,
thanks for your quick reply and sample application.
As you know, I am new to Map Suite framework and controls. I have tested your application and it seems you created a Random Area to select features. It works fine.
My question is how to select directly polygons and change its appearance, without using an area rectangle.
My shape file contains more than 100000 polygons. there is no geodatabase attached to shape file. Shape file contains only polygons and nothing more. Additional data of polygons is in a SQL Server database and I can not attach theme to shape files. I use a query in sql server which returns some polygons ID. Then I want to highlight them in the map.
I hope it was clear enough.
thanks again.
PS:
Hi again.
I found a Method in QueryTools that can select Features By Id "QueryTools.GetFeaturesByIds" and it is exactly what I need.
Problem Solved!
Thanks again Johnny for your great support.
Hi Mehdi,
Great to hear it helped, if you have any more question, please feel free to let us know.
Best Regards
Summer