Layer.IsStyleEnabled Method
Thread safety: This method is thread-safe.
IsStyleEnabled(System.String style)
Checks if a certain style is enabled for the layer or not.Syntax
public System.Boolean IsStyleEnabled (
System.String style
)
Parameters
style
Type: System.String
The name of the style to check.
The name of the style to check.
Return Value
Type: System.Boolean
True if style is enabled, false otherwise.
True if style is enabled, false otherwise.
Remarks
This method works differently depending on the type of layer, see EnableStyle for more information.
Example
// Returns the enabled NamedStyle
public static NamedStyle GetEnabledStyle(Layer layer)
{
// Loop over all NamedStyles in the Layer
foreach (NamedStyle namedStyle in layer.NamedStyles)
{
// Check if the current NamedStyle is enabled
if (layer.IsStyleEnabled(namedStyle.Name))
{
return namedStyle;
}
}
return null;
}
Platforms
Windows, Linux, Android