In This Article

TextStyle Class

Represents style attributes of text.

public class TextStyle : ICloneable
Inheritance:
System.Object Object
Implements:
System.ICloneable

Constructors

TextStyle()

Initializes a new instance of the text style with default values.

public TextStyle()

TextStyle(String, Double, Color)

Initializes a new instance of the text style with the specified font family name, font size, and font color.

public TextStyle(string fontFamilyName, double fontSize, Color textColor)
Parameter Type Description
fontFamilyName System.String

The font family name.

fontSize System.Double

The font size.

textColor System.Windows.Media.Color

The text color.

Properties

Bold

Gets or sets if bold is active.

public bool Bold { get; set; }

Property Value

System.Boolean:

true when active; otherwise, false.

FontFamilyName

Gets or sets the font family name.

public string FontFamilyName { get; set; }

Property Value

System.String:

A string value, or null for the default font.

FontSize

Gets or sets the font size.

public double FontSize { get; set; }

Property Value

System.Double:

A double value.

Italic

Gets or sets if italic is active.

public bool Italic { get; set; }

Property Value

System.Boolean:

true when active; otherwise, false.

TextColor

Gets or sets the text color.

public Color TextColor { get; set; }

Property Value

System.Windows.Media.Color:

A System.Windows.Media.Color.

Underline

Gets or sets if underline is active.

public bool Underline { get; set; }

Property Value

System.Boolean:

true when active; otherwise, false.

Methods

Clone()

Creates a new object that is a copy of the current instance.

public TextStyle Clone()

Returns

TextStyle:

A new object that is a copy of this instance.

Equals(Object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)
Parameter Type Description
obj System.Object

The object to compare with the current object.

Returns

System.Boolean:

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

System.Int32:

A hash code for the current object.

Explicit Interface Implementations

ICloneable.Clone()

Creates a new object that is a copy of the current instance.

object ICloneable.Clone()

Returns

System.Object:

A new object that is a copy of this instance.

Inherited Members

  • System.Object.ToString()
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetType()
  • System.Object.MemberwiseClone()