ClassStyleDefinition
Represents a style definition in the Telerik Documents Model, encapsulating style properties such as font, color, and layout settings that can be applied to document elements.
Definition
Namespace:Telerik.Windows.Documents.Model.Styles
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class StyleDefinition : INotifyStylePropertyChange, IElementWithStyle, INotifyPropertyChanged
Inheritance: objectStyleDefinition
Implements:
Constructors
StyleDefinition(DocumentElement)
Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement
Declaration
public StyleDefinition(DocumentElement element)
Parameters
element
DocumentElement that would be used to determine the StyleType
StyleDefinition(StyleDefinition)
Creates a new instance of StyleDefinition and copies all relevant property values from the specified StyleDefinition instance.
Declaration
public StyleDefinition(StyleDefinition styleDefinition)
Parameters
styleDefinition
The instance to copy the properties from.
StyleDefinition(StyleType)
Creates a new instance of StyleDefinition of corresponding StyleType
Declaration
public StyleDefinition(StyleType styleType)
Parameters
styleType
StyleType corresponding to the type of document elements this style should apply to
StyleDefinition(string, DocumentElement)
Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement, with specified Name
Declaration
public StyleDefinition(string name, DocumentElement element)
Parameters
name
Unique Name of the style, that would be used to identify style in StyleRepository collection
element
DocumentElement that would be used to determine the StyleType
StyleDefinition(string, StyleType)
Creates a new instance of StyleDefinition of corresponding StyleType and Name (style id).
Declaration
public StyleDefinition(string name, StyleType styleType)
Parameters
name
Unique Name of the style, that would be used to identify style in StyleRepository collection
styleType
StyleType corresponding to the type of document elements this style should apply to
Properties
BasedOn
Gets or sets the base StyleDefinition
Declaration
public StyleDefinition BasedOn { get; set; }
Property Value
Remarks
StyleDefinition inherits its property values from BasedOn style. Either BasedOn or BasedOnName can be specified. If BasedOnName is specified BasedOn StyleDefinition would be set automatically if this style definition is added to a document StyleRepository that contains StyleDefinition with corresponding Name.
BasedOnName
Gets or sets the name of base style
Declaration
[XamlSerializable("")]
public string BasedOnName { get; set; }
Property Value
Remarks
StyleDefinition inherits its property values from BasedOn style. Either BasedOn or BasedOnName can be specified. If BasedOnName is specified BasedOn StyleDefinition would be set automatically if this style definition is added to a document StyleRepository that contains StyleDefinition with corresponding Name.
ConditionalTableStylesCollection
Represents a collection of conditional table styles that can be applied to tables in a document.
Declaration
public ConditionalTableStylesCollection ConditionalTableStylesCollection { get; }
Property Value
Remarks
This collection provides functionality to manage and customize styles based on specific conditions.
DisplayName
Gets or sets value corresponding to the name of the style, that would be displayed in Styles dialog, style gallery and other parts of the UI
Declaration
[XamlSerializable("")]
public string DisplayName { get; set; }
Property Value
Document
Gets RadDocument that owns this StyleDefinition instance.
IsCustom
Gets or sets value indicating whether the style is custom user-created
Declaration
[XamlSerializable]
public bool IsCustom { get; set; }
Property Value
IsDefault
Gets or sets value indicating whether the style will be applied by default to the document elements of type corresponding to style's Type.
Declaration
[XamlSerializable]
public bool IsDefault { get; set; }
Property Value
IsPrimary
Gets or sets value indicating whether the style will be visible in the styles gallery.
Declaration
[XamlSerializable]
public bool IsPrimary { get; set; }
Property Value
LinkedStyle
Gets or sets linked StyleDefinition. Only Paragraph and Character types of styles can be linked
Declaration
public StyleDefinition LinkedStyle { get; set; }
Property Value
Remarks
This property can be set to Paragraph or Character style only. Paragraph style can be linked only to Character style and vice versa. StyleDefinition would obtain the corresponding property values from the linked style. Either LenkedStyle or LinkedStyleName can be specified. If BasedOnName is specified BasedOn StyleDefinition would be set automatically if this style definition is added to a document StyleRepository that contains StyleDefinition with corresponding Name.
LinkedStyleName
Gets or sets the name of the linked style.
Declaration
[XamlSerializable("")]
public string LinkedStyleName { get; set; }
Property Value
Remarks
This property can be set to Paragraph or Character style only. Paragraph style can be linked only to Character style and vice versa. StyleDefinition would obtain the corresponding property values from the linked style. Either LinkedStyle or LinkedStyleName can be specified. If BasedOnName is specified BasedOn StyleDefinition would be set automatically if this style definition is added to a document StyleRepository that contains StyleDefinition with corresponding Name.
Name
Gets or sets value corresponding to the unique name of the style, that would be used to identify style in StyleRepository collection in the document
Declaration
[XamlSerializable]
public string Name { get; set; }
Property Value
NextStyleName
Gets or sets the style which shall automatically be applied to a new paragraph created following a paragraph with this style.
Declaration
[XamlSerializable("")]
public string NextStyleName { get; set; }
Property Value
The name of the next style.
Remarks
This property will have effect when set to Paragraph style only.
ParagraphProperties
Gets properties related to Paragraphs in the document
Declaration
public ParagraphProperties ParagraphProperties { get; set; }
Property Value
SpanProperties
Gets properties related to Spans in the document
Declaration
public SpanProperties SpanProperties { get; set; }
Property Value
TableCellProperties
Gets properties related to Table-cells in the document
Declaration
public TableCellProperties TableCellProperties { get; set; }
Property Value
TableProperties
Gets properties related to Tables in the document
Declaration
public TableProperties TableProperties { get; set; }
Property Value
TableRowProperties
Gets properties related to Table-rows in the document
Declaration
public TableRowProperties TableRowProperties { get; set; }
Property Value
Type
Gets or sets StyleType corresponding to the type of document elements this style should be applied to.
Declaration
[XamlSerializable]
public StyleType Type { get; set; }
Property Value
UIPriority
Gets or sets the UI priority of the style. Negative values will be transformed to zero (0);
Declaration
[XamlSerializable(10000)]
public int UIPriority { get; set; }
Property Value
The UI priority.
Methods
Clear()
Clears all styles from the current style definition.
Declaration
public void Clear()
ClearPropertyValue(IStylePropertyDefinition)
Clears the value of the specified style property for the current style definition.
Declaration
public void ClearPropertyValue(IStylePropertyDefinition property)
Parameters
property
The style property definition whose value should be cleared.
CopyPropertiesFrom(StyleDefinition)
Copies properties from the specified StyleDefinition to the current instance.
Declaration
public void CopyPropertiesFrom(StyleDefinition fromStyleDefinition)
Parameters
fromStyleDefinition
The StyleDefinition from which properties will be copied.
GetProperty(IStylePropertyDefinition)
Metod provided for backward compatibility. Please use the provided properties instead.
Declaration
public StylePropertyBase GetProperty(IStylePropertyDefinition propertyDefinition)
Parameters
propertyDefinition
Returns
GetPropertyValue(IStylePropertyDefinition, DocumentElement)
Metod provided for backward compatibility. Please use the provided properties instead.
Declaration
public object GetPropertyValue(IStylePropertyDefinition propertyDefinition, DocumentElement initialValueEvaluationCaller = null)
Parameters
propertyDefinition
initialValueEvaluationCaller
Returns
GetStyleTypeForElement(IElementWithStyle)
Retrieves the style type associated with the specified element that has a style.
Declaration
public static StyleType? GetStyleTypeForElement(IElementWithStyle element)
Parameters
element
The element for which to retrieve the style type. It must implement IElementWithStyle.
Returns
The style type corresponding to the specified element.
IsPropertySet(IStylePropertyDefinition)
Determines whether the specified style property is set in the style definition.
Declaration
public bool IsPropertySet(IStylePropertyDefinition propertyDefinition)
Parameters
propertyDefinition
The style property definition to check.
Returns
True if the specified style property is set; otherwise, false.
MergePropertiesWith(StyleDefinition)
Merges the properties of the specified style definition with the current style definition.
Declaration
public void MergePropertiesWith(StyleDefinition definitionToMergeWith)
Parameters
definitionToMergeWith
The style definition to merge with the current one.
OnDisplayNameChanged(NameChangingEventArgs)
Declaration
protected virtual void OnDisplayNameChanged(NameChangingEventArgs args)
Parameters
args
OnIsPrimaryChanged()
Declaration
protected virtual void OnIsPrimaryChanged()
OnNameChanged(NameChangingEventArgs)
Declaration
protected virtual void OnNameChanged(NameChangingEventArgs args)
Parameters
args
OnStylePropertyChanged(IStylePropertyDefinition, object, object)
Declaration
protected virtual void OnStylePropertyChanged(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters
propertyDefinition
oldValue
newValue
OnStylePropertyChanging(IStylePropertyDefinition, object, object)
Declaration
protected virtual void OnStylePropertyChanging(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters
propertyDefinition
oldValue
newValue
SetPropertyValue(IStylePropertyDefinition, object)
Metod provided for backward compatibility. Please use the provided properties instead.
Declaration
public void SetPropertyValue(IStylePropertyDefinition propertyDefinition, object newValue)
Parameters
propertyDefinition
newValue
ToString()
Gets the string representation of this StyleDefinition that can be used to display information about property values.
Events
DisplayNameChanged
Declaration
public event EventHandler<NameChangingEventArgs> DisplayNameChanged
Event Value
NameChanged
Declaration
public event EventHandler<NameChangingEventArgs> NameChanged
Event Value
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Value
Implements
StylePropertyChanged
Declaration
public event StylePropertyChangeEventHandler StylePropertyChanged
Event Value
Implements
StylePropertyChanging
Declaration
public event StylePropertyChangeEventHandler StylePropertyChanging
Event Value
Implements