Community
@augusto.goncalves - Augusto, thanks for this start for the Display Style Layers. There are a few issues that should be addressed, however. This does not work with Link, Marker, or Shape styles, and when iterating the entire StylesRoot it will crash when it gets to the HorizontalGeometryBandStyle's last 3 Enums (the ones with Curvature in their names). Here is what I found to work for all styles, at least I think it's getting all of them now.
public static List<string> GetDisplayStylesLayer(StyleBase style) { List<string> layers = new List<string>(); // get all methods that contains "DisplayStyle" on their names var methods = style.GetType().GetMethods() .Where(m => (m.Name.Contains("DisplayStyle") && !m.Name.Contains("_"))); // run through the collection of methods foreach (MethodInfo method in methods) { var methodparams = method.GetParameters(); if (methodparams.Length > 1) continue; // if more than 1, then we don't know if (methodparams.Length == 0)//With no params, it's either a Link, Marker, or Shape style...possibly others. { DisplayStyle dispStyle = method.Invoke(style, new object[] {}) as DisplayStyle; if (dispStyle == null) continue; layers.Add(dispStyle.Layer); continue; } ParameterInfo param = methodparams[0]; if (!param.ParameterType.IsEnum) continue; // not a enum, skip // check all values on the enum foreach (var enumValue in Enum.GetValues( param.ParameterType)) { try { DisplayStyle dispStyle = method.Invoke(style, new object[] { enumValue }) as DisplayStyle; if (dispStyle == null || enumValue.ToString().Contains("Curvature")) continue;// something went wrong layers.Add(dispStyle.Layer); } catch { }//SectionViewMaterial Table type has a Profile property but it throws a error because it really doesn't apply, let's catch it. } } return layers; }