StyleDefinition
Definition
Namespace:Telerik.WinForms.Documents.Model.Styles
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public class StyleDefinition : INotifyStylePropertyChange, IElementWithStyle, INotifyPropertyChanged
Inheritance: objectStyleDefinition
Implements:
Constructors
Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement
public StyleDefinition(DocumentElement element)
DocumentElement that would be used to determine the StyleType
Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement, with specified Name
public StyleDefinition(string name, DocumentElement element)
Unique Name of the style, that would be used to identify style in StyleRepository collection
elementDocumentElementDocumentElement that would be used to determine the StyleType
Creates a new instance of StyleDefinition of corresponding StyleType and Name (style id).
Creates a new instance of StyleDefinition and copies all relevant property values from the specified StyleDefinition instance.
public StyleDefinition(StyleDefinition styleDefinition)
The instance to copy the properties from.
Creates a new instance of StyleDefinition of corresponding StyleType
public StyleDefinition(StyleType styleType)
StyleType corresponding to the type of document elements this style should apply to
Properties
Gets or sets the base StyleDefinition
public StyleDefinition BasedOn { get; set; }
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.
Gets or sets the name of base style
[XamlSerializable("")]
public string BasedOnName { get; set; }
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.
public ConditionalTableStylesCollection ConditionalTableStylesCollection { get; }
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
[XamlSerializable("")]
public string DisplayName { get; set; }
Gets RadDocument that owns this StyleDefinition instance.
public RadDocument Document { get; }
Gets or sets value indicating whether the style is custom user-created
[XamlSerializable]
public bool IsCustom { get; set; }
Gets or sets value indicating whether the style will be applied by default to the document elements of type corresponding to style's Type.
[XamlSerializable]
public bool IsDefault { get; set; }
Gets or sets value indicating whether the style will be visible in the styles gallery.
[XamlSerializable]
public bool IsPrimary { get; set; }
Gets or sets linked StyleDefinition. Only Paragraph and Character types of styles can be linked
public StyleDefinition LinkedStyle { get; set; }
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.
Gets or sets the name of the linked style.
[XamlSerializable("")]
public string LinkedStyleName { get; set; }
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.
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
[XamlSerializable]
public string Name { get; set; }
Gets or sets the style which shall automatically be applied to a new paragraph created following a paragraph with this style.
[XamlSerializable("")]
public string NextStyleName { get; set; }
The name of the next style.
This property will have effect when set to Paragraph style only.
Gets properties related to Paragraphs in the document
public ParagraphProperties ParagraphProperties { get; set; }
Gets properties related to Spans in the document
public SpanProperties SpanProperties { get; set; }
Gets properties related to Table-cells in the document
public TableCellProperties TableCellProperties { get; set; }
Gets properties related to Tables in the document
public TableProperties TableProperties { get; set; }
Gets properties related to Table-rows in the document
public TableRowProperties TableRowProperties { get; set; }
Gets or sets StyleType corresponding to the type of document elements this style should be applied to.
[XamlSerializable]
public StyleType Type { get; set; }
Gets or sets the UI priority of the style. Negative values will be transformed to zero (0);
[XamlSerializable(10000)]
public int UIPriority { get; set; }
The UI priority.
Methods
public void Clear()
public void ClearPropertyValue(IStylePropertyDefinition property)
public void CopyPropertiesFrom(StyleDefinition fromStyleDefinition)
Metod provided for backward compatibility. Please use the provided properties instead.
public StylePropertyBase GetProperty(IStylePropertyDefinition propertyDefinition)
Metod provided for backward compatibility. Please use the provided properties instead.
public object GetPropertyValue(IStylePropertyDefinition propertyDefinition, DocumentElement initialValueEvaluationCaller = null)
public static StyleType? GetStyleTypeForElement(IElementWithStyle element)
public bool IsPropertySet(IStylePropertyDefinition propertyDefinition)
public void MergePropertiesWith(StyleDefinition definitionToMergeWith)
protected virtual void OnDisplayNameChanged(NameChangingEventArgs args)
protected virtual void OnIsPrimaryChanged()
protected virtual void OnNameChanged(NameChangingEventArgs args)
protected virtual void OnStylePropertyChanged(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
protected virtual void OnStylePropertyChanging(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Metod provided for backward compatibility. Please use the provided properties instead.
public void SetPropertyValue(IStylePropertyDefinition propertyDefinition, object newValue)
Gets the string representation of this StyleDefinition that can be used to display information about property values.
Events
public event EventHandler<NameChangingEventArgs> DisplayNameChanged
public event EventHandler IsPrimaryChanged
public event EventHandler<NameChangingEventArgs> NameChanged
public event PropertyChangedEventHandler PropertyChanged
Implements:
public event StylePropertyChangeEventHandler StylePropertyChanged
Implements:
public event StylePropertyChangeEventHandler StylePropertyChanging
Implements: