New to Telerik UI for WinFormsStart a free 30-day trial

Definition

Namespace:Telerik.WinForms.Documents.Model.Styles

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class StyleDefinition : INotifyStylePropertyChange, IElementWithStyle, INotifyPropertyChanged

Inheritance: objectStyleDefinition

Implements: IElementWithStyleINotifyPropertyChangedINotifyStylePropertyChange

Constructors

Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement

C#
public StyleDefinition(DocumentElement element)
Parameters:elementDocumentElement

DocumentElement that would be used to determine the StyleType

Creates a new instance of StyleDefinition of StyleType corresponding to specific DocumentElement, with specified Name

C#
public StyleDefinition(string name, DocumentElement element)
Parameters:namestring

Unique Name of the style, that would be used to identify style in StyleRepository collection

elementDocumentElement

DocumentElement that would be used to determine the StyleType

Creates a new instance of StyleDefinition of corresponding StyleType and Name (style id).

C#
public StyleDefinition(string name, StyleType styleType)
Parameters:namestring

Unique Name of the style, that would be used to identify style in StyleRepository collection

styleTypeStyleType

StyleType corresponding to the type of document elements this style should apply to

Creates a new instance of StyleDefinition and copies all relevant property values from the specified StyleDefinition instance.

C#
public StyleDefinition(StyleDefinition styleDefinition)
Parameters:styleDefinitionStyleDefinition

The instance to copy the properties from.

Creates a new instance of StyleDefinition of corresponding StyleType

C#
public StyleDefinition(StyleType styleType)
Parameters:styleTypeStyleType

StyleType corresponding to the type of document elements this style should apply to

Properties

Gets or sets the base StyleDefinition

C#
public StyleDefinition BasedOn { get; set; }
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.

Gets or sets the name of base style

C#
[XamlSerializable("")]
public string BasedOnName { get; set; }
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.

C#
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

C#
[XamlSerializable("")]
public string DisplayName { get; set; }

Gets RadDocument that owns this StyleDefinition instance.

C#
public RadDocument Document { get; }

Gets or sets value indicating whether the style is custom user-created

C#
[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.

C#
[XamlSerializable]
public bool IsDefault { get; set; }

Gets or sets value indicating whether the style will be visible in the styles gallery.

C#
[XamlSerializable]
public bool IsPrimary { get; set; }

Gets or sets linked StyleDefinition. Only Paragraph and Character types of styles can be linked

C#
public StyleDefinition LinkedStyle { get; set; }
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.

Gets or sets the name of the linked style.

C#
[XamlSerializable("")]
public string LinkedStyleName { get; set; }
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.

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

C#
[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.

C#
[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.

Gets properties related to Paragraphs in the document

C#
public ParagraphProperties ParagraphProperties { get; set; }

Gets properties related to Spans in the document

C#
public SpanProperties SpanProperties { get; set; }

Gets properties related to Table-cells in the document

C#
public TableCellProperties TableCellProperties { get; set; }

Gets properties related to Tables in the document

C#
public TableProperties TableProperties { get; set; }

Gets properties related to Table-rows in the document

C#
public TableRowProperties TableRowProperties { get; set; }

Gets or sets StyleType corresponding to the type of document elements this style should be applied to.

C#
[XamlSerializable]
public StyleType Type { get; set; }

Gets or sets the UI priority of the style. Negative values will be transformed to zero (0);

C#
[XamlSerializable(10000)]
public int UIPriority { get; set; }
Property Value:

The UI priority.

Methods

C#
public void Clear()
C#
public void ClearPropertyValue(IStylePropertyDefinition property)
Parameters:propertyIStylePropertyDefinition
C#
public void CopyPropertiesFrom(StyleDefinition fromStyleDefinition)
Parameters:fromStyleDefinitionStyleDefinition

Metod provided for backward compatibility. Please use the provided properties instead.

C#
public StylePropertyBase GetProperty(IStylePropertyDefinition propertyDefinition)
Parameters:propertyDefinitionIStylePropertyDefinitionReturns:

StylePropertyBase

Metod provided for backward compatibility. Please use the provided properties instead.

C#
public object GetPropertyValue(IStylePropertyDefinition propertyDefinition, DocumentElement initialValueEvaluationCaller = null)
Parameters:propertyDefinitionIStylePropertyDefinitioninitialValueEvaluationCallerDocumentElementReturns:

object

C#
public static StyleType? GetStyleTypeForElement(IElementWithStyle element)
Parameters:elementIElementWithStyleReturns:

StyleType?

C#
public bool IsPropertySet(IStylePropertyDefinition propertyDefinition)
Parameters:propertyDefinitionIStylePropertyDefinitionReturns:

bool

C#
public void MergePropertiesWith(StyleDefinition definitionToMergeWith)
Parameters:definitionToMergeWithStyleDefinition
C#
protected virtual void OnDisplayNameChanged(NameChangingEventArgs args)
Parameters:argsNameChangingEventArgs
C#
protected virtual void OnIsPrimaryChanged()
C#
protected virtual void OnNameChanged(NameChangingEventArgs args)
Parameters:argsNameChangingEventArgs
C#
protected virtual void OnStylePropertyChanged(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters:propertyDefinitionIStylePropertyDefinitionoldValueobjectnewValueobject
C#
protected virtual void OnStylePropertyChanging(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters:propertyDefinitionIStylePropertyDefinitionoldValueobjectnewValueobject

Metod provided for backward compatibility. Please use the provided properties instead.

C#
public void SetPropertyValue(IStylePropertyDefinition propertyDefinition, object newValue)
Parameters:propertyDefinitionIStylePropertyDefinitionnewValueobject

Gets the string representation of this StyleDefinition that can be used to display information about property values.

C#
public override string ToString()
Returns:

string

Overrides: object.ToString()

Events

C#
public event EventHandler<NameChangingEventArgs> DisplayNameChanged
C#
public event EventHandler IsPrimaryChanged
C#
public event EventHandler<NameChangingEventArgs> NameChanged
C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged

C#
public event StylePropertyChangeEventHandler StylePropertyChanged

Implements: INotifyStylePropertyChange.StylePropertyChanged

C#
public event StylePropertyChangeEventHandler StylePropertyChanging

Implements: INotifyStylePropertyChange.StylePropertyChanging

Extension Methods