Text​Element Text​Element Text​Element Class

Definition

An abstract class used as the base class for the also-abstract Block and Inline classes. TextElement supports common API for classes involved in the XAML text object model, such as properties that control text size, font families and so on.

public class TextElement : DependencyObject, ITextElement, ITextElement2, ITextElement3, ITextElement4, ITextElementOverridespublic class TextElement : DependencyObject, ITextElement, ITextElement2, ITextElement3, ITextElement4, ITextElementOverridesPublic Class TextElement Inherits DependencyObject Implements ITextElement, ITextElement2, ITextElement3, ITextElement4, ITextElementOverrides
Inheritance
TextElementTextElementTextElement
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Inherited properties

Remarks

The various properties defined by TextElement support a common API for classes involved in the XAML text object model. Here's a list of the most commonly used properties:

By setting TextElement properties, you can apply common text formatting properties to text, both in blocks and in inlines. There are also additional ways to format text, but these aren't directly supported by TextElement. Instead, you can use the attached properties of the Typography class. Typography attached properties typically support advanced typographic features or conventions, such as accessing typographic features defined at the font level that are not necessarily supported by all fonts. For example, you could set Typography.Variants as an attached property on any text block or inline, and this would influence the font-variants behavior as enabled by the particular font you chose for setting FontFamily on that text element.

TextElement doesn't inherently define a connection point to a XAML visual tree. In other words a TextElement defines text and text object model within that text, but it doesn't yet enable the display of that text within a UI. For that, you need to use one of the controls or elements that are descendants of UIElement and can be connected to the XAML tree and the root visual of your app window. There are two such elements in the Windows Runtime:

  • TextBlock: Supports a text object model of inlines only with its Inlines collection.
  • RichTextBlock: Supports a block text object model with its Blocks collection. The blocks can contain blocks and inlines.
Note

PasswordBox, RichEditBox and TextBox don't support a text object model that's based on TextElement. RichEditBox does enable programmatic access to a different text object model through the ITextDocument interface.

TextElement defines API that support examining the text object model as programming objects after the XAML is parsed. In particular TextElement implements Name and Language, which parallel properties of the same name on FrameworkElement. TextElement also implements FindName (a utility method for finding objects at run time based on how Name was set in initial XAML), and OnDisconnectVisualChildren (for advanced scenarios and designer support).

TextElement has four properties that provide access to TextPointer objects from within text. These properties are: ContentStart, ContentEnd, ElementStart, ElementEnd. A Windows Runtime TextPointer object gives you an entry point for traversal of content. For more info, see TextPointer.

TextElement is a class derived from DependencyObject. That means it can define dependency properties, and each of the read-write properties of TextElement is a dependency property, with its property identifier also defined by TextElement. For more info on what dependency properties enable, see Dependency properties overview.

TextElement derived classes

TextElement is the parent class for two derived classes that split the text object model into two text usage conventions: Block, and Inline. Block and Inline are both considered base classes (you don't typically see a <Block> tag in XAML) and exist in the hierarchy mainly to be the parent class of other practical text elements. For example, Block is the parent class of Paragraph. For more info on how to use block and inline elements, see Quickstart: Displaying text.

Properties

AccessKey AccessKey AccessKey

Gets or sets the access key for this element.

public PlatForm::String AccessKey { get; set; }public string AccessKey { get; set; }Public ReadWrite Property AccessKey As string
Value
string string string

The access key for this element.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

AccessKeyProperty AccessKeyProperty AccessKeyProperty

Identifies the AccessKey dependency property.

public static DependencyProperty AccessKeyProperty { get; }public static DependencyProperty AccessKeyProperty { get; }Public Static ReadOnly Property AccessKeyProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the AccessKey dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

AccessKeyScopeOwner AccessKeyScopeOwner AccessKeyScopeOwner

Gets or sets a source element that provides the access key scope for this element, even if it's not in the visual tree of the source element.

public DependencyObject AccessKeyScopeOwner { get; set; }public DependencyObject AccessKeyScopeOwner { get; set; }Public ReadWrite Property AccessKeyScopeOwner As DependencyObject
Value
DependencyObject DependencyObject DependencyObject

The element that defines the access key scope.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

The source element must have it's IsAccessKeyScope property set to true.

AccessKeyScopeOwnerProperty AccessKeyScopeOwnerProperty AccessKeyScopeOwnerProperty

Identifies the AccessKeyScopeOwner dependency property.

public static DependencyProperty AccessKeyScopeOwnerProperty { get; }public static DependencyProperty AccessKeyScopeOwnerProperty { get; }Public Static ReadOnly Property AccessKeyScopeOwnerProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the AccessKeyScopeOwner dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

AllowFocusOnInteraction AllowFocusOnInteraction AllowFocusOnInteraction

Gets or sets a value that indicates whether the element automatically gets focus when the user interacts with it.

public PlatForm::Boolean AllowFocusOnInteraction { get; set; }public bool AllowFocusOnInteraction { get; set; }Public ReadWrite Property AllowFocusOnInteraction As bool
<textElementAllowFocusOnInteraction="bool"/>
Value
bool bool bool

true if the element gets focus when a user interacts with it; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

AllowFocusOnInteractionProperty AllowFocusOnInteractionProperty AllowFocusOnInteractionProperty

Identifies the AllowFocusOnInteraction dependency property.

public static DependencyProperty AllowFocusOnInteractionProperty { get; }public static DependencyProperty AllowFocusOnInteractionProperty { get; }Public Static ReadOnly Property AllowFocusOnInteractionProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the AllowFocusOnInteraction dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

CharacterSpacing CharacterSpacing CharacterSpacing

Gets or sets the uniform spacing between characters, in units of 1/1000 of an em.

public int CharacterSpacing { get; set; }public int CharacterSpacing { get; set; }Public ReadWrite Property CharacterSpacing As int
<textElement CharacterSpacing="int"/>
Value
int int int

The uniform spacing between characters, in units of 1/1000 of an em. The default is 0. Positive values increase tracking and loosen character spacing. Negative values decrease tracking and tighten the character spacing.

Attributes

CharacterSpacingProperty CharacterSpacingProperty CharacterSpacingProperty

Identifies the CharacterSpacing dependency property.

public static DependencyProperty CharacterSpacingProperty { get; }public static DependencyProperty CharacterSpacingProperty { get; }Public Static ReadOnly Property CharacterSpacingProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the CharacterSpacing dependency property.

Attributes

ContentEnd ContentEnd ContentEnd

Gets a TextPointer that represents the end of the content in the element.

public TextPointer ContentEnd { get; }public TextPointer ContentEnd { get; }Public ReadOnly Property ContentEnd As TextPointer
Value
TextPointer TextPointer TextPointer

A TextPointer that represents the end of the content in the TextElement.

Attributes

ContentStart ContentStart ContentStart

Gets a TextPointer that represents the start of content in the element.

public TextPointer ContentStart { get; }public TextPointer ContentStart { get; }Public ReadOnly Property ContentStart As TextPointer
Value
TextPointer TextPointer TextPointer

A TextPointer that represents the start of the content in the TextElement.

Attributes

ElementEnd ElementEnd ElementEnd

Gets a TextPointer that represents the position just after the end of the element.

public TextPointer ElementEnd { get; }public TextPointer ElementEnd { get; }Public ReadOnly Property ElementEnd As TextPointer
Value
TextPointer TextPointer TextPointer

A TextPointer that represents the position just after the end of the TextElement.

Attributes

ElementStart ElementStart ElementStart

Gets a TextPointer that represents the position just before the start of the element.

public TextPointer ElementStart { get; }public TextPointer ElementStart { get; }Public ReadOnly Property ElementStart As TextPointer
Value
TextPointer TextPointer TextPointer

A TextPointer that represents the position just before the start of the TextElement.

Attributes

ExitDisplayModeOnAccessKeyInvoked ExitDisplayModeOnAccessKeyInvoked ExitDisplayModeOnAccessKeyInvoked

Gets or sets a value that specifies whether the access key display is dismissed when an access key is invoked.

public PlatForm::Boolean ExitDisplayModeOnAccessKeyInvoked { get; set; }public bool ExitDisplayModeOnAccessKeyInvoked { get; set; }Public ReadWrite Property ExitDisplayModeOnAccessKeyInvoked As bool
Value
bool bool bool

true to dismiss the access key display when an access key is invoked; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

ExitDisplayModeOnAccessKeyInvokedProperty ExitDisplayModeOnAccessKeyInvokedProperty ExitDisplayModeOnAccessKeyInvokedProperty

Identifies the ExitDisplayModeOnAccessKeyInvoked dependency property.

public static DependencyProperty ExitDisplayModeOnAccessKeyInvokedProperty { get; }public static DependencyProperty ExitDisplayModeOnAccessKeyInvokedProperty { get; }Public Static ReadOnly Property ExitDisplayModeOnAccessKeyInvokedProperty As DependencyProperty
Attributes
Additional features and requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

FontFamily FontFamily FontFamily

Gets or sets the preferred top-level font family for the content of the element.

public FontFamily FontFamily { get; set; }public FontFamily FontFamily { get; set; }Public ReadWrite Property FontFamily As FontFamily
<textElement FontFamily="fontFamily" />
-or-
<textElement FontFamily="fontFamilyName[,fallbackFontFamilyName]" />
-or-
<textElement FontFamily="fontURI#fontFamily" />
Value
FontFamily FontFamily FontFamily

The preferred font family, or a primary preferred font family with one or more fallback font families. See FontFamily for default information.

Attributes

FontFamilyProperty FontFamilyProperty FontFamilyProperty

Identifies the FontFamily dependency property.

public static DependencyProperty FontFamilyProperty { get; }public static DependencyProperty FontFamilyProperty { get; }Public Static ReadOnly Property FontFamilyProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the FontFamily dependency property.

Attributes

FontSize FontSize FontSize

Gets or sets the font size for the content of the element.

public double FontSize { get; set; }public double FontSize { get; set; }Public ReadWrite Property FontSize As double
<textElement FontSize="double" /> 
Value
double double double

The desired font size in pixels. The default is 11 pixels.

Attributes

FontSizeProperty FontSizeProperty FontSizeProperty

Identifies the FontSize dependency property.

public static DependencyProperty FontSizeProperty { get; }public static DependencyProperty FontSizeProperty { get; }Public Static ReadOnly Property FontSizeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the FontSize dependency property.

Attributes

FontStretch FontStretch FontStretch

Gets or sets the glyph width of the font in a family to select.

public FontStretch FontStretch { get; set; }public FontStretch FontStretch { get; set; }Public ReadWrite Property FontStretch As FontStretch
<textElement FontStretch="fontStretchMemberName"/>
Value
FontStretch FontStretch FontStretch

One of the FontStretch constant names, specifying the desired font stretch. The default is Normal.

Attributes

FontStretchProperty FontStretchProperty FontStretchProperty

Identifies the FontStretch dependency property.

public static DependencyProperty FontStretchProperty { get; }public static DependencyProperty FontStretchProperty { get; }Public Static ReadOnly Property FontStretchProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the FontStretch dependency property.

Attributes

FontStyle FontStyle FontStyle

Gets or sets the font style for the content in this element.

public FontStyle FontStyle { get; set; }public FontStyle FontStyle { get; set; }Public ReadWrite Property FontStyle As FontStyle
<textElement FontStyle="fontStyleMemberName"/>
Value
FontStyle FontStyle FontStyle

One of the FontStyle constant names, specifying the font style. The default is Normal.

Attributes

FontStyleProperty FontStyleProperty FontStyleProperty

Identifies the FontStyle dependency property.

public static DependencyProperty FontStyleProperty { get; }public static DependencyProperty FontStyleProperty { get; }Public Static ReadOnly Property FontStyleProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the FontStyle dependency property.

Attributes

FontWeight FontWeight FontWeight

Gets or sets the top-level font weight to select from the font family for the content in this element.

public FontWeight FontWeight { get; set; }public FontWeight FontWeight { get; set; }Public ReadWrite Property FontWeight As FontWeight
<textElement FontWeight="fontWeightsValue"/>
Value
FontWeight FontWeight FontWeight

One of the FontWeights property values, specifying the font weight. The default is Normal.

Attributes

FontWeightProperty FontWeightProperty FontWeightProperty

Identifies the FontWeight dependency property.

public static DependencyProperty FontWeightProperty { get; }public static DependencyProperty FontWeightProperty { get; }Public Static ReadOnly Property FontWeightProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the FontWeight dependency property.

Attributes

Foreground Foreground Foreground

Gets or sets the Brush to apply to the content in this element.

public Brush Foreground { get; set; }public Brush Foreground { get; set; }Public ReadWrite Property Foreground As Brush
<textElementForeground="{StaticResource resourceName}"/>

Value
Brush Brush Brush

The brush that is applied to the text content. The default is a SolidColorBrush with Color value Black.

Attributes

Remarks

Setting Foreground has no visible effect for LineBreak or InlineUIContainer objects.

See Also

ForegroundProperty ForegroundProperty ForegroundProperty

Identifies the Foreground dependency property.

public static DependencyProperty ForegroundProperty { get; }public static DependencyProperty ForegroundProperty { get; }Public Static ReadOnly Property ForegroundProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

Identifier for the Foreground dependency property.

Attributes

IsAccessKeyScope IsAccessKeyScope IsAccessKeyScope

Gets or sets a value that indicates whether an element defines its own access key scope.

public PlatForm::Boolean IsAccessKeyScope { get; set; }public bool IsAccessKeyScope { get; set; }Public ReadWrite Property IsAccessKeyScope As bool
Value
bool bool bool

true if an element defines its own scope; otherwise, false.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

IsAccessKeyScopeProperty IsAccessKeyScopeProperty IsAccessKeyScopeProperty

Identifies the IsAccessKeyScope dependency property.

public static DependencyProperty IsAccessKeyScopeProperty { get; }public static DependencyProperty IsAccessKeyScopeProperty { get; }Public Static ReadOnly Property IsAccessKeyScopeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsAccessKeyScope dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

IsTextScaleFactorEnabled IsTextScaleFactorEnabled IsTextScaleFactorEnabled

Gets or sets whether automatic text enlargement, to reflect the system text size setting, is enabled.

public PlatForm::Boolean IsTextScaleFactorEnabled { get; set; }public bool IsTextScaleFactorEnabled { get; set; }Public ReadWrite Property IsTextScaleFactorEnabled As bool
<textElement IsTextScaleFactorEnabled="bool"/>
Value
bool bool bool

true if automatic text enlargement is enabled; otherwise, false.

Attributes
See Also

IsTextScaleFactorEnabledProperty IsTextScaleFactorEnabledProperty IsTextScaleFactorEnabledProperty

Identifies the IsTextScaleFactorEnabled dependency property.

public static DependencyProperty IsTextScaleFactorEnabledProperty { get; }public static DependencyProperty IsTextScaleFactorEnabledProperty { get; }Public Static ReadOnly Property IsTextScaleFactorEnabledProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the IsTextScaleFactorEnabled dependency property.

Attributes

KeyTipHorizontalOffset KeyTipHorizontalOffset KeyTipHorizontalOffset

Gets or sets a value that indicates how far left or right the keytip is placed in relation to the text element.

public double KeyTipHorizontalOffset { get; set; }public double KeyTipHorizontalOffset { get; set; }Public ReadWrite Property KeyTipHorizontalOffset As double
<textElement KeyTipHorizontalOffset="double"/>
Value
double double double

The number of pixels to move the KeyTip. Positive values move it right. Negative values move it left.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

KeyTipHorizontalOffsetProperty KeyTipHorizontalOffsetProperty KeyTipHorizontalOffsetProperty

Identifies the KeyTipHorizontalOffset dependency property.

public static DependencyProperty KeyTipHorizontalOffsetProperty { get; }public static DependencyProperty KeyTipHorizontalOffsetProperty { get; }Public Static ReadOnly Property KeyTipHorizontalOffsetProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the KeyTipHorizontalOffset dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

KeyTipPlacementMode KeyTipPlacementMode KeyTipPlacementMode

Gets or sets a value that indicates where the KeyTip is placed in relation to the text element.

public KeyTipPlacementMode KeyTipPlacementMode { get; set; }public KeyTipPlacementMode KeyTipPlacementMode { get; set; }Public ReadWrite Property KeyTipPlacementMode As KeyTipPlacementMode
<textElement KeyTipPlacementMode="keyTipPlacementModeMemberName"/>
Value
KeyTipPlacementMode KeyTipPlacementMode KeyTipPlacementMode

A value of the enumeration. The default is Auto.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

KeyTipPlacementModeProperty KeyTipPlacementModeProperty KeyTipPlacementModeProperty

Identifies the KeyTipPlacementMode dependency property.

public static DependencyProperty KeyTipPlacementModeProperty { get; }public static DependencyProperty KeyTipPlacementModeProperty { get; }Public Static ReadOnly Property KeyTipPlacementModeProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the KeyTipPlacementMode dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

KeyTipVerticalOffset KeyTipVerticalOffset KeyTipVerticalOffset

Gets or sets a value that indicates how far up or down the keytip is placed in relation to the text element.

public double KeyTipVerticalOffset { get; set; }public double KeyTipVerticalOffset { get; set; }Public ReadWrite Property KeyTipVerticalOffset As double
<textElement KeyTipVerticalOffset="double"/>
Value
double double double

The number of pixels to move the KeyTip. Positive values move it down. Negative values move it up.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

KeyTipVerticalOffsetProperty KeyTipVerticalOffsetProperty KeyTipVerticalOffsetProperty

Identifies the KeyTipVerticalOffset dependency property.

public static DependencyProperty KeyTipVerticalOffsetProperty { get; }public static DependencyProperty KeyTipVerticalOffsetProperty { get; }Public Static ReadOnly Property KeyTipVerticalOffsetProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the KeyTipVerticalOffset dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Language Language Language

Gets or sets localization/globalization language information that applies to a TextElement.

public PlatForm::String Language { get; set; }public string Language { get; set; }Public ReadWrite Property Language As string
<textElement Language="languageString" .../.
Value
string string string

A string specifying language and culture that follows the RFC 3066 / ISO 639-1 standards. For example, U.S. English is "en-US".

Attributes

LanguageProperty LanguageProperty LanguageProperty

Identifies the Language dependency property.

public static DependencyProperty LanguageProperty { get; }public static DependencyProperty LanguageProperty { get; }Public Static ReadOnly Property LanguageProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the Language dependency property.

Attributes

Name Name Name

Gets or sets a unique identification for the object. Name can only be set from initial parsing of XAML.

public PlatForm::String Name { get; }public string Name { get; }Public ReadOnly Property Name As string
<textElement Name="xamlNameString"/>
Value
string string string

The unique identifier for the object. This property is read-only for code, but write-only for XAML, due to special parser handling of XAML properties named "Name".

Attributes

TextDecorations TextDecorations TextDecorations

Gets or sets a value that indicates what decorations are applied to the text.

public TextDecorations TextDecorations { get; set; }public TextDecorations TextDecorations { get; set; }Public ReadWrite Property TextDecorations As TextDecorations
Value
TextDecorations TextDecorations TextDecorations

A value of the enumeration. The default is None.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

TextDecorationsProperty TextDecorationsProperty TextDecorationsProperty

Identifies the TextDecorations dependency property.

public static DependencyProperty TextDecorationsProperty { get; }public static DependencyProperty TextDecorationsProperty { get; }Public Static ReadOnly Property TextDecorationsProperty As DependencyProperty
Value
DependencyProperty DependencyProperty DependencyProperty

The identifier for the TextDecorations dependency property.

Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Methods

FindName(String) FindName(String) FindName(String)

Retrieves an object in the object model / runtime object graph by referencing the object's x:Name or Name attribute value.

public PlatForm::Object FindName(String name)public object FindName(String name)Public Function FindName(name As String) As object
Parameters
name
System.String System.String System.String

The name of the object to retrieve.

Returns
object object object

The object that has the specified name, or null if no object is retrieved.

Attributes

Remarks

FrameworkElement is the class that implements Name support for most other run-time classes, but TextElement is not a FrameworkElement derived class. TextElement supports its own Name and FindName implementations, and the underlying logic for name lookup does not differentiate between TextElement and FrameworkElement. You can use the TextElement -implemented FindName to find a named FrameworkElement, and vice versa.

Because FindName relies on all the XAML sources being parsed for the Name attributes, you should not attempt to call FindName until the XAML is loaded.

Names and FindName are influenced by the concept of a XAML namescope.

OnDisconnectVisualChildren() OnDisconnectVisualChildren() OnDisconnectVisualChildren()

Override this method to implement how layout and logic should behave when items are removed from a class-specific content or child property.

protected virtual void OnDisconnectVisualChildren()protected virtual void OnDisconnectVisualChildren()Protected Overridable Function OnDisconnectVisualChildren() As void
Attributes

Remarks

TextElement does not define any of the content or children properties that OnDisconnectVisualChildren might act upon. Such properties are introduced by derived classes such as Paragraph.

Events

AccessKeyDisplayDismissed AccessKeyDisplayDismissed AccessKeyDisplayDismissed

Occurs when the access key sequence is complete to notify controls that they should hide access key visuals.

public event TypedEventHandler AccessKeyDisplayDismissedpublic event TypedEventHandler AccessKeyDisplayDismissedPublic Event AccessKeyDisplayDismissed
Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

AccessKeyDisplayRequested AccessKeyDisplayRequested AccessKeyDisplayRequested

Occurs when the access key sequence is started to notify controls that they should show access key visuals.

public event TypedEventHandler AccessKeyDisplayRequestedpublic event TypedEventHandler AccessKeyDisplayRequestedPublic Event AccessKeyDisplayRequested
Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

This event is not raised if the element is under an element with its Visibility property set to Collapsed.

AccessKeyInvoked AccessKeyInvoked AccessKeyInvoked

Occurs when a user completes an access key sequence to notify the element that the access key action should be invoked.

public event TypedEventHandler AccessKeyInvokedpublic event TypedEventHandler AccessKeyInvokedPublic Event AccessKeyInvoked
Attributes
Additional features and requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Remarks

For more info, see UIElement.AccessKeyInvoked.

See Also