Show / Hide Table of Contents

Class RichTextBlock

Represents a control that displays read-only rich text.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
RichTextBlock
Inherited Members
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.LogicalChildren
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.OnApplyTemplate()
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.ManageIsEnabled(Boolean)
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.OnMouseMove(MouseEventArgs)
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.OnMouseWheel(MouseWheelEventArgs)
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.OnTextInput(TextCompositionEventArgs)
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.OnKeyDown(KeyEventArgs)
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.OnGotFocus(RoutedEventArgs)
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.OnLostFocus(RoutedEventArgs)
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class RichTextBlock : FrameworkElement, IFrameworkElement, IUIElement, IDependencyObject

Constructors

| Improve this Doc View Source

RichTextBlock()

Initializes a new instance of the RichTextBlock class.

Declaration
public RichTextBlock()

Fields

| Improve this Doc View Source

CharacterSpacingProperty

Identifies the CharacterSpacing dependency property.

Declaration
public static readonly DependencyProperty CharacterSpacingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontFamilyProperty

Identifies the FontFamily dependency property.

Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontSizeProperty

Identifies the FontSize dependency property.

Declaration
public static readonly DependencyProperty FontSizeProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontStretchProperty

Identifies the FontStretch dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty FontStretchProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontStyleProperty

Identifies the FontStyle dependency property.

Declaration
public static readonly DependencyProperty FontStyleProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontWeightProperty

Identifies the FontWeight dependency property.

Declaration
public static readonly DependencyProperty FontWeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ForegroundProperty

Identifies the Foreground dependency property.

Declaration
public static readonly DependencyProperty ForegroundProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

HasOverflowContentProperty

Identifies the HasOverflowContent dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty HasOverflowContentProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsTextSelectionEnabledProperty

Identifies the IsTextSelectionEnabled dependency property.

Declaration
public static readonly DependencyProperty IsTextSelectionEnabledProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

LineHeightProperty

Identifies the LineHeight dependency property.

Declaration
public static readonly DependencyProperty LineHeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

LineStackingStrategyProperty

Identifies the LineStackingStrategy dependency property.

Declaration
public static readonly DependencyProperty LineStackingStrategyProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

OverflowContentTargetProperty

Identifies the OverflowContentTarget dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty OverflowContentTargetProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

PaddingProperty

Identifies the Padding dependency property.

Declaration
public static readonly DependencyProperty PaddingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

SelectedTextProperty

Identifies the SelectedText dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty SelectedTextProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TextAlignmentProperty

Identifies the TextAlignment dependency property.

Declaration
public static readonly DependencyProperty TextAlignmentProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TextTrimmingProperty

Identifies the TextTrimming dependency property.

Declaration
public static readonly DependencyProperty TextTrimmingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TextWrappingProperty

Identifies the TextWrapping dependency

Declaration
public static readonly DependencyProperty TextWrappingProperty
Field Value
Type Description
DependencyProperty

Properties

| Improve this Doc View Source

BaselineOffset

Gets a value that represents the offset in pixels from the top of the content to the baseline of the first paragraph. The baseline of the paragraph is the baseline of the first line in it.

Declaration
public double BaselineOffset { get; }
Property Value
Type Description
System.Double

The computed baseline for the first paragraph, or 0 if the RichTextBlock is empty.

| Improve this Doc View Source

Blocks

Gets the contents of the RichTextBlock.

Declaration
public BlockCollection Blocks { get; }
Property Value
Type Description
BlockCollection
| Improve this Doc View Source

CharacterSpacing

Gets or sets the distance between characters of text in the control measured in 1000ths of the font size.

Declaration
public int CharacterSpacing { get; set; }
Property Value
Type Description
System.Int32

The distance between characters of text in the control measured in 1000ths of the font size. The default is 0.

| Improve this Doc View Source

ContentEnd

Gets a TextPointer that indicates the end of content in the RichTextBlock.

Declaration
[NotImplemented]
public TextPointer ContentEnd { get; }
Property Value
Type Description
TextPointer

Returns TextPointer.

| Improve this Doc View Source

ContentStart

Gets a TextPointer that indicates the start of content in the RichTextBlock.

Declaration
[NotImplemented]
public TextPointer ContentStart { get; }
Property Value
Type Description
TextPointer

A TextPointer that indicates the start of content in the RichTextBlock.

| Improve this Doc View Source

FontFamily

Gets or sets the font used to display text in the control. The default is the "Portable User Interface".

Declaration
public FontFamily FontFamily { get; set; }
Property Value
Type Description
FontFamily
| Improve this Doc View Source

FontSize

Gets or sets the size of the text in this control. The default is 11 (in pixels).

Declaration
public double FontSize { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

FontStretch

Gets or sets the degree to which a font is condensed or expanded on the screen.

Declaration
[NotImplemented]
public FontStretch FontStretch { get; set; }
Property Value
Type Description
FontStretch

One of the values that specifies the degree to which a font is condensed or expanded on the screen. The default is Normal.

| Improve this Doc View Source

FontStyle

Gets or sets the style in which the text is rendered.

Declaration
public FontStyle FontStyle { get; set; }
Property Value
Type Description
FontStyle

One of the values that specifies the style in which the text is rendered. The default is Normal.

| Improve this Doc View Source

FontWeight

Gets or sets the thickness of the specified font. The default is Normal.

Declaration
public FontWeight FontWeight { get; set; }
Property Value
Type Description
FontWeight
| Improve this Doc View Source

Foreground

Gets or sets a brush that describes the foreground color.

Declaration
public Brush Foreground { get; set; }
Property Value
Type Description
Brush
Remarks

The brush that paints the foreground of the control. The default value is Black.

| Improve this Doc View Source

HasOverflowContent

Gets or sets a value that indicates whether the RichTextBlock has overflow content.

Declaration
[NotImplemented]
public bool HasOverflowContent { get; }
Property Value
Type Description
System.Boolean

true if RichTextBlock has overflow content; false otherwise.

| Improve this Doc View Source

IsTextSelectionEnabled

Gets or sets a value that indicates whether text selection is enabled in RichTextBlock.

Declaration
public bool IsTextSelectionEnabled { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

LineHeight

Gets or sets the height of each line of content.

Declaration
public double LineHeight { get; set; }
Property Value
Type Description
System.Double

The height of each line in pixels. A value of 0 indicates that the line height is determined automatically from the current font characteristics. The default is 0.

| Improve this Doc View Source

LineStackingStrategy

Gets or sets a value that indicates how a line box is determined for each line of text in the RichTextBlock.

Declaration
public LineStackingStrategy LineStackingStrategy { get; set; }
Property Value
Type Description
LineStackingStrategy

A value that indicates how a line box is determined for each line of text in the RichTextBlock. The default is MaxHeight.

| Improve this Doc View Source

OverflowContentTarget

Gets or sets the RichTextBlockOverflow that will consume the overflow content of this RichTextBlock.

Declaration
[NotImplemented]
public RichTextBlockOverflow OverflowContentTarget { get; set; }
Property Value
Type Description
RichTextBlockOverflow
| Improve this Doc View Source

Padding

Gets or sets a value that indicates the thickness of padding space between the boundaries of the content area and the content displayed by a RichTextBlock.

Declaration
public Thickness Padding { get; set; }
Property Value
Type Description
Thickness

A Thickness structure that specifies the amount of padding to apply.

| Improve this Doc View Source

SelectedText

Gets the plain text of the current selection in RichTextBlock.

Declaration
[NotImplemented]
public string SelectedText { get; }
Property Value
Type Description
System.String

the plain text of the current selection in RichTextBlock.

| Improve this Doc View Source

SelectionEnd

Gets a TextPointer that indicates the start of the selection in the RichTextBlock or a chain of linked containers.

Declaration
[NotImplemented]
public TextPointer SelectionEnd { get; }
Property Value
Type Description
TextPointer

A TextPointer that indicates the start of the selection in the RichTextBlock or a chain of linked containers.

| Improve this Doc View Source

SelectionStart

Gets a TextPointer that indicates the start of the selection in a RichTextBlock or a chain of linked containers.

Declaration
[NotImplemented]
public TextPointer SelectionStart { get; }
Property Value
Type Description
TextPointer

A TextPointer that indicates the start of the selection in a RichTextBlock or a chain of linked containers.

| Improve this Doc View Source

TextAlignment

Gets or sets how the text should be aligned in the RichTextBlock.

Declaration
public TextAlignment TextAlignment { get; set; }
Property Value
Type Description
TextAlignment

One of the TextAlignment enumeration values. The default is Left.

| Improve this Doc View Source

TextTrimming

Gets or sets the text trimming behavior to employ when content overflows the content area.

Declaration
public TextTrimming TextTrimming { get; set; }
Property Value
Type Description
TextTrimming

One of the TextTrimming values that specifies the text trimming behavior to employ. The default is None.

| Improve this Doc View Source

TextWrapping

Gets or sets how text wrapping occurs if a line of text extends beyond the available width of the RichTextBlock. The default is Wrap.

Declaration
public TextWrapping TextWrapping { get; set; }
Property Value
Type Description
TextWrapping
| Improve this Doc View Source

VisualChildrenCount

Declaration
protected sealed override int VisualChildrenCount { get; }
Property Value
Type Description
System.Int32
Overrides
FrameworkElement.VisualChildrenCount

Methods

| Improve this Doc View Source

ArrangeOverride(Size)

Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type Name Description
Size finalSize
Returns
Type Description
Size
Overrides
FrameworkElement.ArrangeOverride(Size)
| Improve this Doc View Source

CreateDomElement(Object, out Object)

Declaration
public override object CreateDomElement(object parentRef, out object domElementWhereToPlaceChildren)
Parameters
Type Name Description
System.Object parentRef
System.Object domElementWhereToPlaceChildren
Returns
Type Description
System.Object
Overrides
FrameworkElement.CreateDomElement(Object, out Object)
| Improve this Doc View Source

GetPositionFromPoint(Point)

Returns a TextPointer that indicates the closest insertion position for the specified point.

Declaration
[NotImplemented]
public TextPointer GetPositionFromPoint(Point point)
Parameters
Type Name Description
Point point

A point in the coordinate space of the RichTextBlock for which the closest insertion position is retrieved.

Returns
Type Description
TextPointer

A TextPointer that indicates the closest insertion position for the specified point.

| Improve this Doc View Source

GetVisualChild(Int32)

Declaration
protected sealed override UIElement GetVisualChild(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
UIElement
Overrides
FrameworkElement.GetVisualChild(Int32)
| Improve this Doc View Source

INTERNAL_OnAttachedToVisualTree()

Declaration
protected override void INTERNAL_OnAttachedToVisualTree()
Overrides
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
| Improve this Doc View Source

MeasureOverride(Size)

Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
Type Name Description
Size availableSize
Returns
Type Description
Size
Overrides
FrameworkElement.MeasureOverride(Size)
| Improve this Doc View Source

OnCreateAutomationPeer()

Declaration
[NotImplemented]
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type Description
AutomationPeer
Overrides
UIElement.OnCreateAutomationPeer()
| Improve this Doc View Source

Select(TextPointer, TextPointer)

Selects the content between two positions indicated by textpointer objects.

Declaration
[NotImplemented]
public void Select(TextPointer start, TextPointer end)
Parameters
Type Name Description
TextPointer start

The text pointer which marks the start position end of the updated selection.

TextPointer end

The text pointer which marks the end position of the other end of the updated selection.

| Improve this Doc View Source

SelectAll()

Selects the entire contents in the RichTextBlock.

Declaration
[NotImplemented]
public void SelectAll()

Events

| Improve this Doc View Source

SelectionChanged

Occurs when the text selection has changed.

Declaration
[NotImplemented]
public event RoutedEventHandler SelectionChanged
Event Type
Type Description
RoutedEventHandler

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source