Changing the Symbology of layers while added programeticaly to a uxMap

Mar 12, 2014 at 9:35 PM
Edited Mar 12, 2014 at 9:37 PM
Hello Friends,
I am trying to create a custom application and i am new to both C# and Dot spatial
I managed to create the application and to add shapefiles to both Legend and Map but as i run the application a random color is given to Layers
my problem is to Preset the Symbology of my layers to specified colors
can any one help me on this Issue
It will be much appreciated
PS My layers are Polygons and lines
Thank you
Mar 13, 2014 at 8:38 PM
Come on Guys I need help please!!!
Mar 14, 2014 at 7:09 PM
Sample how to add layer and set custom color to first category:
var ml = App.Map.AddLayer();
((IMapFeatureLayer) ml).Symbology.GetCategories().First().SetColor(Color.Red);
Of course it will work only when new layer is IMapFeatureLayer (shape files).
Marked as answer by RayansFather on 3/14/2014 at 12:56 PM
Mar 14, 2014 at 7:55 PM
Thank you mogikanin,
Much appreciated

it worked fine in setting the color of the Polygon and i still need to learn how to set the outline color
i tried to use the
PolygonSymbolizer lightblue = new PolygonSymbolizer(Color.LightBlue);
lightblue.OutlineSymbolizer = new LineSymbolizer(Color.Blue, 1);
myLayer.Symbolizer = lightblue;
as in the Developer's corner document but it does not work it gives me this Message

'DotSpatial.Controls.IMapLayer' does not contain a definition for 'Symbolizer' and no extension method 'Symbolizer' accepting a first argument of type 'DotSpatial.Controls.IMapLayer' could be found (are you missing a using directive or an assembly reference?)
thank you again for your Help
Mar 14, 2014 at 9:21 PM
Hey Mogikanin!!!!
I found it
Now going to the Selection will let you know
Again thank you for your help
Marked as answer by RayansFather on 3/14/2014 at 2:22 PM