Fundamentals
Components
Code Utilities
Demo
BcStylesStyleBuilder
Description
BcCssStyleBuilder is a utility class that helps dynamically manage inline CSS styles in Blazor applications. It enables adding, removing, and formatting styles efficiently.
Methods
AddStyle ( string cssProperty, string? cssValue, bool important = false )
Adds a new CSS property and value to the style collection. If the property already exists, it is updated.
void
RemoveStyle ( string cssProperty )
Removes a specified CSS property from the style collection.
void
AddStylesByString ( string? stylesString )
Parses a CSS style string and applies each style property to the collection.
void
Clear ( bool force = true )
Removes all stored styles from the collection.
void
GetStyles ( )
Returns the computed style string based on all stored styles.
string
WithAdditionalStyles ( string additionalStyles )
Returns the current style string with additional styles appended.
string
ToString ( )
Returns the cached string representation of all styles.
string