skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class StyleDefinition

Inheritance
System.Object
StyleDefinition
Namespace: Telerik.Windows.Documents.Model.Styles
Assembly: Telerik.Windows.Documents.dll

Syntax

public class StyleDefinition : Object, INotifyStylePropertyChange, IElementWithStyle, INotifyPropertyChanged

Constructors

StyleDefinition()

Declaration
public StyleDefinition()

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
System.String name

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

DocumentElement 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
System.String name

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

StyleType styleType

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

StyleDefinition(DocumentElement)

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

Declaration
public StyleDefinition(DocumentElement element)
Parameters
DocumentElement 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 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

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
StyleDefinition

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
System.String

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

Declaration
public ConditionalTableStylesCollection ConditionalTableStylesCollection { get; }
Property Value
ConditionalTableStylesCollection

ConditionalTableStylesList

Property used for serialization only. Use ConditionalTableStylesCollection instead.

Declaration
[XamlCompositePropertySerializable]
public List<ConditionalTableStyleInfo> ConditionalTableStylesList { get; set; }
Property Value
System.Collections.Generic.List<ConditionalTableStyleInfo>

Description

Declaration
public string Description { get; }
Property Value
System.String

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
System.String

Document

Gets RadDocument that owns this StyleDefinition instance.

Declaration
public RadDocument Document { get; }
Property Value
RadDocument

IsCustom

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

Declaration
[XamlSerializable]
public bool IsCustom { get; set; }
Property Value
System.Boolean

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
System.Boolean

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
System.Boolean

LinkedStyle

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

Declaration
public StyleDefinition LinkedStyle { get; set; }
Property Value
StyleDefinition

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
System.String

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
System.String

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
System.String

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
ParagraphProperties

ParagraphStyle

Declaration
[XamlCompositePropertySerializable]
public ParagraphProperties ParagraphStyle { get; set; }
Property Value
ParagraphProperties

SpanProperties

Gets properties related to Spans in the document

Declaration
public SpanProperties SpanProperties { get; set; }
Property Value
SpanProperties

SpanStyle

Declaration
[XamlCompositePropertySerializable]
public SpanProperties SpanStyle { get; set; }
Property Value
SpanProperties

TableCellProperties

Gets properties related to Table-cells in the document

Declaration
public TableCellProperties TableCellProperties { get; set; }
Property Value
TableCellProperties

TableCellStyle

Declaration
[XamlCompositePropertySerializable]
public TableCellProperties TableCellStyle { get; set; }
Property Value
TableCellProperties

TableProperties

Gets properties related to Tables in the document

Declaration
public TableProperties TableProperties { get; set; }
Property Value
TableProperties

TableRowProperties

Gets properties related to Table-rows in the document

Declaration
public TableRowProperties TableRowProperties { get; set; }
Property Value
TableRowProperties

TableRowStyle

Declaration
[XamlCompositePropertySerializable]
public TableRowProperties TableRowStyle { get; set; }
Property Value
TableRowProperties

TableStyle

Declaration
[XamlCompositePropertySerializable]
public TableProperties TableStyle { get; set; }
Property Value
TableProperties

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
StyleType

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
System.Int32

The UI priority.

Methods

add_StylePropertyChanged(StylePropertyChangeEventHandler)

Declaration
public void add_StylePropertyChanged(StylePropertyChangeEventHandler value)
Parameters
StylePropertyChangeEventHandler value

Implements
INotifyStylePropertyChange.add_StylePropertyChanged(StylePropertyChangeEventHandler)

add_StylePropertyChanging(StylePropertyChangeEventHandler)

Declaration
public void add_StylePropertyChanging(StylePropertyChangeEventHandler value)
Parameters
StylePropertyChangeEventHandler value

Implements
INotifyStylePropertyChange.add_StylePropertyChanging(StylePropertyChangeEventHandler)

Clear()

Declaration
public void Clear()

ClearPropertyValue(IStylePropertyDefinition)

Declaration
public void ClearPropertyValue(IStylePropertyDefinition property)
Parameters
IStylePropertyDefinition property

CopyPropertiesFrom(StyleDefinition)

Declaration
public void CopyPropertiesFrom(StyleDefinition fromStyleDefinition)
Parameters
StyleDefinition fromStyleDefinition

GetProperty(IStylePropertyDefinition)

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

Declaration
public StylePropertyBase GetProperty(IStylePropertyDefinition propertyDefinition)
Parameters
IStylePropertyDefinition propertyDefinition

Returns
StylePropertyBase

GetPropertyValue(IStylePropertyDefinition, DocumentElement)

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

Declaration
public object GetPropertyValue(IStylePropertyDefinition propertyDefinition, DocumentElement initialValueEvaluationCaller = null)
Parameters
IStylePropertyDefinition propertyDefinition

DocumentElement initialValueEvaluationCaller

Returns
System.Object

GetStyleTypeForElement(IElementWithStyle)

Declaration
public static Nullable<StyleType> GetStyleTypeForElement(IElementWithStyle element)
Parameters
IElementWithStyle element

Returns
System.Nullable<StyleType>

IsPropertySet(IStylePropertyDefinition)

Declaration
public bool IsPropertySet(IStylePropertyDefinition propertyDefinition)
Parameters
IStylePropertyDefinition propertyDefinition

Returns
System.Boolean

MergePropertiesWith(StyleDefinition)

Declaration
public void MergePropertiesWith(StyleDefinition definitionToMergeWith)
Parameters
StyleDefinition definitionToMergeWith

OnDisplayNameChanged(NameChangingEventArgs)

Declaration
protected virtual void OnDisplayNameChanged(NameChangingEventArgs args)
Parameters
NameChangingEventArgs args

OnIsPrimaryChanged()

Declaration
protected virtual void OnIsPrimaryChanged()

OnNameChanged(NameChangingEventArgs)

Declaration
protected virtual void OnNameChanged(NameChangingEventArgs args)
Parameters
NameChangingEventArgs args

OnStylePropertyChanged(IStylePropertyDefinition, Object, Object)

Declaration
protected virtual void OnStylePropertyChanged(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters
IStylePropertyDefinition propertyDefinition

System.Object oldValue

System.Object newValue

OnStylePropertyChanging(IStylePropertyDefinition, Object, Object)

Declaration
protected virtual void OnStylePropertyChanging(IStylePropertyDefinition propertyDefinition, object oldValue, object newValue)
Parameters
IStylePropertyDefinition propertyDefinition

System.Object oldValue

System.Object newValue

remove_StylePropertyChanged(StylePropertyChangeEventHandler)

Declaration
public void remove_StylePropertyChanged(StylePropertyChangeEventHandler value)
Parameters
StylePropertyChangeEventHandler value

Implements
INotifyStylePropertyChange.remove_StylePropertyChanged(StylePropertyChangeEventHandler)

remove_StylePropertyChanging(StylePropertyChangeEventHandler)

Declaration
public void remove_StylePropertyChanging(StylePropertyChangeEventHandler value)
Parameters
StylePropertyChangeEventHandler value

Implements
INotifyStylePropertyChange.remove_StylePropertyChanging(StylePropertyChangeEventHandler)

SetPropertyValue(IStylePropertyDefinition, Object)

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

Declaration
public void SetPropertyValue(IStylePropertyDefinition propertyDefinition, object newValue)
Parameters
IStylePropertyDefinition propertyDefinition

System.Object newValue

ToString()

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

Declaration
public override string ToString()
Returns
System.String

Events

DisplayNameChanged

Declaration
public event EventHandler<NameChangingEventArgs> DisplayNameChanged
Event Type
System.EventHandler<NameChangingEventArgs>

IsPrimaryChanged

Declaration
public event EventHandler IsPrimaryChanged
Event Type
System.EventHandler

NameChanged

Declaration
public event EventHandler<NameChangingEventArgs> NameChanged
Event Type
System.EventHandler<NameChangingEventArgs>

PropertyChanged

Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
System.ComponentModel.PropertyChangedEventHandler

StylePropertyChanged

Declaration
public event StylePropertyChangeEventHandler StylePropertyChanged
Event Type
StylePropertyChangeEventHandler

Implements
INotifyStylePropertyChange.StylePropertyChanged

StylePropertyChanging

Declaration
public event StylePropertyChangeEventHandler StylePropertyChanging
Event Type
StylePropertyChangeEventHandler

Implements
INotifyStylePropertyChange.StylePropertyChanging

Explicit Interface Implementations

IElementWithStyle.OnStyleRemovedFromDocument()

Declaration
void IElementWithStyle.OnStyleRemovedFromDocument()
Implements
IElementWithStyle.OnStyleRemovedFromDocument()

IElementWithStyle.Style

Declaration
StyleDefinition IElementWithStyle.Style { get; set; }
Returns
StyleDefinition

Implements
IElementWithStyle.Style

IElementWithStyle.StyleName

Declaration
string IElementWithStyle.StyleName { get; set; }
Returns
System.String

Implements
IElementWithStyle.StyleName

IElementWithStyle.StyleNameChanged()

Declaration
void IElementWithStyle.StyleNameChanged()
Implements
IElementWithStyle.StyleNameChanged()

IElementWithStyle.StylePropertyChanged(Object, StylePropertyChangeEventArgs)

Declaration
void IElementWithStyle.StylePropertyChanged(object sender, StylePropertyChangeEventArgs args)
Parameters
System.Object sender

StylePropertyChangeEventArgs args

Implements
IElementWithStyle.StylePropertyChanged(Object, StylePropertyChangeEventArgs)

IElementWithStyle.StylePropertyChanging(Object, StylePropertyChangeEventArgs)

Declaration
void IElementWithStyle.StylePropertyChanging(object sender, StylePropertyChangeEventArgs args)
Parameters
System.Object sender

StylePropertyChangeEventArgs args

Implements
IElementWithStyle.StylePropertyChanging(Object, StylePropertyChangeEventArgs)

Extension Methods

CollectionExtensions.ToEnumerable<T>(T)
ExtensionMethods.HasLinkedStyleOfType(StyleDefinition, StyleType)
EnumerableExtensions.ToEnumerable<T>(T)

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
  • Themes Generator
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
  • System Requirements
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.