ClassStyleCollection
Represents a collection of styles that can be applied to document elements.
Definition
Namespace:Telerik.Windows.Documents.Model
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class StyleCollection : INotifyCollectionChanged, IEnumerable<StyleDefinition>, IEnumerable
Inheritance: objectStyleCollection
Implements:
Constructors
StyleCollection(RadDocument)
Declaration
public StyleCollection(RadDocument document)
Parameters
document
Properties
Count
Gets the number of styles in the collection.
Document
Gets the associated RadDocument.
this[string]
Declaration
public StyleDefinition this[string styleName] { get; }
Parameters
styleName
Property Value
Methods
Add(StyleDefinition)
Adds a new style definition to the collection.
Declaration
public void Add(StyleDefinition style)
Parameters
style
The style definition to be added to the collection.
Clear()
Removes all styles from the collection.
Declaration
public void Clear()
Remarks
This method clears the collection of any previously added styles, leaving it empty. Use this method when you want to reset the style collection.
GetValueOrNull(string, bool)
Get style from the repository by name.
Declaration
public StyleDefinition GetValueOrNull(string styleName, bool autoAddBuiltInStyles = true)
Parameters
styleName
Name of the style.
autoAddBuiltInStyles
True to automatically add built in styles into the repository.
Returns
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Declaration
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args)
Parameters
args
Remove(StyleDefinition)
Removes a specified style definition from the style collection.
Declaration
public void Remove(StyleDefinition style)
Parameters
style
The style definition to be removed from the collection.
Remove(string)
Removes a style from the collection by its name.
Declaration
public void Remove(string name)
Parameters
name
The name of the style to remove.
Events
CollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Value
Implements