Programmatically hide categories

Aug 14, 2014 at 9:27 AM
I'm trying to build an application in which some roads must appear. In order to not penalty the performance when the zoom level is low, the roads shown should depend on it. I've tried to approach a solution by categorizing the roads and then set the 'Symbolizer.IsVisible' property of each one to 'true' or 'false'. However, this seems not to work.

Could you give any idea about how to do it? The code I'm using is as follows:
_roadScheme = new LineScheme();
_roadScheme.EditorSettings.ClassificationType = ClassificationType.UniqueValues;
_roadScheme.EditorSettings.FieldName = _cfg.RoadMap.TypeField;
_layerRoads.Symbology = _roadScheme;

foreach (LineCategory cat in _roadScheme.Categories)
    cat.Symbolizer.IsVisible = false;