Partilhar via


TextFormattingRunProperties Class

Definition

Holds text formatting property information. This class derives from the abstract WPF TextRunProperties class.

public ref class TextFormattingRunProperties sealed : System::Windows::Media::TextFormatting::TextRunProperties, System::Runtime::Serialization::IObjectReference, System::Runtime::Serialization::ISerializable
[System.Serializable]
public sealed class TextFormattingRunProperties : System.Windows.Media.TextFormatting.TextRunProperties, System.Runtime.Serialization.IObjectReference, System.Runtime.Serialization.ISerializable
[<System.Serializable>]
type TextFormattingRunProperties = class
    inherit TextRunProperties
    interface ISerializable
    interface IObjectReference
Public NotInheritable Class TextFormattingRunProperties
Inherits TextRunProperties
Implements IObjectReference, ISerializable
Inheritance
TextFormattingRunProperties
Attributes
Implements

Remarks

This class is used to hold all information about the text formatting properties. Once created, it is immutable and all operations return different objects. For each unique set of TextFormattingRunProperties there exists exactly one object instance. If a TextFormattingRunProperties has reference equality to another, their properties are identical. Conversely, if a TextFormattingRunProperties object has reference inequality, the properties are distinct.

Checking reference equality is the only way to determine whether two TextFormattingRunProperties are distinct. Checking the equality of each property of the object may indicate the two are identical, but that may or may not be the case.

TextFormattingRunProperties may have empty properties. An empty property inherits the empty properties from some additional text. The TextFormattingRunProperties object can determine whether a property is empty or not: [PropertyName]Empty property. TextFormattingRunProperties

  also contains a facility for emptying a property: Clear[PropertyName]().

All freezable fields of the TextFormattingRunProperties object are frozen on creation.

Properties

BackgroundBrush

Gets the background brush.

BackgroundBrushEmpty

Determines whether the background brush is empty.

BackgroundOpacity

Returns the opacity of the background.

BackgroundOpacityEmpty

Determines whether any custom opacity is explicitly set for the background.

Bold

Returns true if the formatting is made explicitly bold.

BoldEmpty

Determines whether the bold property is set.

CultureInfo

Gets the culture information.

CultureInfoEmpty

Determines whether the culture info is empty.

FontHintingEmSize

Gets the font hinting size.

FontHintingEmSizeEmpty

Determines whether the font hinting size is empty.

FontRenderingEmSize

Gets the font rendering size.

FontRenderingEmSizeEmpty

Determines whether the size is empty.

ForegroundBrush

Gets the foreground brush.

ForegroundBrushEmpty

Determines whether the foreground brush is empty.

ForegroundOpacity

Returns the opacity of the foreground.

ForegroundOpacityEmpty

Determines whether any custom opacity is explicitly set for the foreground.

Italic

Returns true if the formatting is made explicitly italic.

ItalicEmpty

Determines whether the italic property is set.

TextDecorations

Gets the decorations for the text.

TextDecorationsEmpty

Determines whether the text decorations collection is empty.

TextEffects

Gets the text effects for the text.

TextEffectsEmpty

Determines whether the text effects collection is empty.

Typeface

Gets the Typeface for the text.

TypefaceEmpty

Determines whether the typeface is empty.

Methods

BackgroundBrushSame(Brush)

Determines whether the background brush for this TextFormattingRunProperties is the same as brush.

ClearBackgroundBrush()

Gets a new TextFormattingRunProperties with all properties the same except for the background brush.

ClearBackgroundOpacity()

Gets a new TextFormattingRunProperties with all properties the same, but clears the BackgroundOpacity property.

ClearBold()

Gets a new TextFormattingRunProperties with all properties the same, but clears the Bold property.

ClearCultureInfo()

Gets a new TextFormattingRunProperties ith all properties the same except for the culture info.

ClearFontHintingEmSize()

Gets a new TextFormattingRunProperties with all properties the same except for the font hinting size.

ClearFontRenderingEmSize()

Gets a new TextFormattingRunProperties with all properties the same except for the rendering size.

ClearForegroundBrush()

Gets a new TextFormattingRunProperties with all properties the same except for the foreground brush.

ClearForegroundOpacity()

Gets a new TextFormattingRunProperties with all properties the same, but clears the ForegroundOpacity property.

ClearItalic()

Gets a new TextFormattingRunProperties with all properties the same, but clears the Italic property.

ClearTextDecorations()

Gets a new TextFormattingRunProperties with all properties the same except for the text decorations.

ClearTextEffects()

Gets a new TextFormattingRunProperties with all properties the same except for the text effects.

ClearTypeface()

Gets a new TextFormattingRunProperties with all properties the same except for the typeface.

CreateTextFormattingRunProperties()

Initializes a new instance of TextFormattingRunProperties.

CreateTextFormattingRunProperties(Brush, Brush, Typeface, Nullable<Double>, Nullable<Double>, TextDecorationCollection, TextEffectCollection, CultureInfo)

Initializes a new instance of TextFormattingRunProperties with the specified options.

CreateTextFormattingRunProperties(Typeface, Double, Color)

Initializes a new instance of TextFormattingRunProperties with the specified options.

ForegroundBrushSame(Brush)

Determines whether the foreground brush for this TextFormattingRunProperties is the same as brush.

GetObjectData(SerializationInfo, StreamingContext)

Serializes the TextFormattingRunProperties object using a XamlWriter.

GetRealObject(StreamingContext)

Gets the interned TextFormattingRunProperties object.

SameSize(TextFormattingRunProperties)

Determines whether font sizes for two TextFormattingRunProperties are the same.

SetBackground(Color)

Gets a new TextFormattingRunProperties with the properties of this one but with the background set to background.

SetBackgroundBrush(Brush)

Gets a new TextFormattingRunProperties with the properties of this one but with the background brush set to brush.

SetBackgroundOpacity(Double)

Gets a new TextFormattingRunProperties with the properties of this one but with the BackgroundOpacity property set to opacity.

SetBold(Boolean)

Gets a new TextFormattingRunProperties with the properties of this one but with the Bold property set to isBold.

SetCultureInfo(CultureInfo)

Gets a new TextFormattingRunProperties with the properties of this one but with the culture set to cultureInfo.

SetFontHintingEmSize(Double)

Gets a new TextFormattingRunProperties with the properties of this one but with the font hinting size set to hintingSize.

SetFontRenderingEmSize(Double)

Gets a new TextFormattingRunProperties with the properties of this one but with the font rendering size set to renderingSize.

SetForeground(Color)

Gets a new TextFormattingRunProperties with the properties of this one but with the foreground set to foreground.

SetForegroundBrush(Brush)

Gets a new TextFormattingRunProperties with the properties of this one but with the new foreground Brush set to brush.

SetForegroundOpacity(Double)

Gets a new TextFormattingRunProperties with the properties of this one but with the ForegroundOpacity property set to opacity.

SetItalic(Boolean)

Gets a new TextFormattingRunProperties with the properties of this one but with the Italic property set to isItalic.

SetTextDecorations(TextDecorationCollection)

Gets a new TextFormattingRunProperties with the properties of this one but with the text decorations set to textDecorations.

SetTextEffects(TextEffectCollection)

Gets a new TextFormattingRunProperties with the properties of this one but with the text effects set to textEffects.

SetTypeface(Typeface)

Gets a new TextFormattingRunProperties with the properties of this one but with the typeface set to typeface.

Applies to