Class RichTextBlock
Represents a control that displays read-only rich text.
Inherited Members
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public sealed class RichTextBlock : FrameworkElement, IFrameworkElement, IUIElement, IDependencyObject
Constructors
| Improve this Doc View SourceRichTextBlock()
Initializes a new instance of the RichTextBlock class.
Declaration
public RichTextBlock()
Fields
| Improve this Doc View SourceCharacterSpacingProperty
Identifies the CharacterSpacing dependency property.
Declaration
public static readonly DependencyProperty CharacterSpacingProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FontFamilyProperty
Identifies the FontFamily dependency property.
Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FontSizeProperty
Identifies the FontSize dependency property.
Declaration
public static readonly DependencyProperty FontSizeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FontStretchProperty
Identifies the FontStretch dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty FontStretchProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FontStyleProperty
Identifies the FontStyle dependency property.
Declaration
public static readonly DependencyProperty FontStyleProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
FontWeightProperty
Identifies the FontWeight dependency property.
Declaration
public static readonly DependencyProperty FontWeightProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ForegroundProperty
Identifies the Foreground dependency property.
Declaration
public static readonly DependencyProperty ForegroundProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
HasOverflowContentProperty
Identifies the HasOverflowContent dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty HasOverflowContentProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsTextSelectionEnabledProperty
Identifies the IsTextSelectionEnabled dependency property.
Declaration
public static readonly DependencyProperty IsTextSelectionEnabledProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
LineHeightProperty
Identifies the LineHeight dependency property.
Declaration
public static readonly DependencyProperty LineHeightProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
LineStackingStrategyProperty
Identifies the LineStackingStrategy dependency property.
Declaration
public static readonly DependencyProperty LineStackingStrategyProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
OverflowContentTargetProperty
Identifies the OverflowContentTarget dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty OverflowContentTargetProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
PaddingProperty
Identifies the Padding dependency property.
Declaration
public static readonly DependencyProperty PaddingProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
SelectedTextProperty
Identifies the SelectedText dependency property.
Declaration
[NotImplemented]
public static readonly DependencyProperty SelectedTextProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TextAlignmentProperty
Identifies the TextAlignment dependency property.
Declaration
public static readonly DependencyProperty TextAlignmentProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TextTrimmingProperty
Identifies the TextTrimming dependency property.
Declaration
public static readonly DependencyProperty TextTrimmingProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
TextWrappingProperty
Identifies the TextWrapping dependency
Declaration
public static readonly DependencyProperty TextWrappingProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceBaselineOffset
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. |
Blocks
Gets the contents of the RichTextBlock.
Declaration
public BlockCollection Blocks { get; }
Property Value
Type | Description |
---|---|
BlockCollection |
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. |
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. |
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. |
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 |
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 |
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. |
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. |
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 |
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.
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. |
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 |
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. |
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. |
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 |
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. |
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. |
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. |
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. |
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. |
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. |
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 |
VisualChildrenCount
Declaration
protected sealed override int VisualChildrenCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
Methods
| Improve this Doc View SourceArrangeOverride(Size)
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
Size | finalSize |
Returns
Type | Description |
---|---|
Size |
Overrides
| Improve this Doc View SourceCreateDomElement(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
| Improve this Doc View SourceGetPositionFromPoint(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. |
GetVisualChild(Int32)
Declaration
protected sealed override UIElement GetVisualChild(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type | Description |
---|---|
UIElement |
Overrides
| Improve this Doc View SourceINTERNAL_OnAttachedToVisualTree()
Declaration
protected override void INTERNAL_OnAttachedToVisualTree()
Overrides
| Improve this Doc View SourceMeasureOverride(Size)
Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
Size | availableSize |
Returns
Type | Description |
---|---|
Size |
Overrides
| Improve this Doc View SourceOnCreateAutomationPeer()
Declaration
[NotImplemented]
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type | Description |
---|---|
AutomationPeer |
Overrides
| Improve this Doc View SourceSelect(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. |
SelectAll()
Selects the entire contents in the RichTextBlock.
Declaration
[NotImplemented]
public void SelectAll()
Events
| Improve this Doc View SourceSelectionChanged
Occurs when the text selection has changed.
Declaration
[NotImplemented]
public event RoutedEventHandler SelectionChanged
Event Type
Type | Description |
---|---|
RoutedEventHandler |