RichTextBlockOverflow RichTextBlockOverflow RichTextBlockOverflow Class

Definition

Represents a rich text display overflow container. This element cannot have direct content. The only purpose of RichTextBlockOverflow is to display text content that does not fit in the bounds of a RichTextBlock or another RichTextBlockOverflow element.

public sealed class RichTextBlockOverflow : FrameworkElement, IRichTextBlockOverflow, IRichTextBlockOverflow2public sealed class RichTextBlockOverflow : FrameworkElement, IRichTextBlockOverflow, IRichTextBlockOverflow2Public NotInheritable Class RichTextBlockOverflow Inherits FrameworkElement Implements IRichTextBlockOverflow, IRichTextBlockOverflow2
<RichTextBlockOverflow .../>
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Remarks

You can use a RichTextBlock with RichTextBlockOverflow elements to create advanced page layouts. The content for a RichTextBlockOverflow element always comes from a RichTextBlock element. You link RichTextBlockOverflow elements by setting them as the OverflowContentTarget of a RichTextBlock or another RichTextBlockOverflow.

Examples

Here, a RichTextBlock targets a RichTextBlockOverflow element to create a multi-column text layout. The first RichTextBlockOverflow element then targets a second RichTextBlockOverflow element that receives its content overflow. The controlling layout factor for how the text overflow is calculated is the constrained Width and Height of the parent Grid, and the ColumnDefinition settings that divide the Grid into three equal columns of 300 pixels height/width. Overflow is also affected by FontSize and many other text formatting properties that change characters in the text.

<Grid x:Name="columnGrid" Background="White" Width="900" Height="300">
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <RichTextBlock Grid.Column="0" IsTextSelectionEnabled="True" TextAlignment="Justify" 
                   OverflowContentTarget="{Binding ElementName=firstOverflowContainer}" 
                   TextIndent="12"
                   FontSize="12" FontFamily="Segoe UI" Foreground="#2a2a2a" Margin="20,0">
        <Paragraph>
            <Bold><Span Foreground="DarkSlateBlue" FontSize="16">Lorem ipsum dolor sit amet</Span></Bold>, consectetur adipiscing elit. Sed ac mi ipsum. Phasellus vel malesuada mauris. Donec pharetra, enim sit amet mattis tincidunt, felis nisi semper lectus, vel porta diam nisi in augue. Pellentesque lacus tortor, aliquam et faucibus id, rhoncus ut justo. Sed id lectus odio, eget pulvinar diam. Suspendisse eleifend ornare libero, in luctus purus aliquet non. Sed interdum, sem vitae rutrum rhoncus, felis ligula ultrices sem, in eleifend eros ante id neque. Vivamus quam lorem, varius vitae porta mollis, placerat quis est. Aenean eget sagittis massa. Sed tellus turpis, ullamcorper eget imperdiet vel, faucibus vel nisl. Nunc sed suscipit quam. Vivamus convallis faucibus dignissim. Fusce sollicitudin, quam vel cursus mattis, nisl velit tristique sapien, ac vestibulum ante arcu a nisl. Vestibulum commodo gravida ante at tincidunt. Vestibulum in ornare nunc. Nullam ut lorem vitae dui placerat lacinia sit amet a arcu. Nulla sit amet odio nisi. Praesent erat urna, venenatis ac adipiscing vel, congue at lectus. Proin ac metus at quam luctus ultricies.
        </Paragraph>
        <Paragraph>
            <Italic>This is an inline image.</Italic>
            <InlineUIContainer>
                <Border Background="Black">
                    <Image Source="Assets/SmallLogo.png" Height="30" Width="30"/>
                </Border>
            </InlineUIContainer> 
            Nam vitae ligula non ligula suscipit semper. Duis sed nulla metus, id hendrerit velit. Curabitur dolor purus, bibendum eu cursus lacinia, interdum vel augue. Aenean euismod eros et sapien vehicula dictum. Duis ullamcorper, turpis nec feugiat tincidunt, dui erat luctus risus, aliquam accumsan lacus est vel quam. Nunc lacus massa, varius eget accumsan id, congue sed orci. Duis dignissim hendrerit egestas. Proin ut turpis magna, sit amet porta erat. Nunc semper metus nec magna imperdiet nec vestibulum dui fringilla. Sed sed ante libero, nec porttitor mi. Ut luctus, neque vitae placerat egestas, urna leo auctor magna, sit amet ultricies ipsum felis quis sapien. Proin eleifend varius dui, at vestibulum nunc consectetur nec. Mauris nulla elit, ultrices a sodales non, aliquam ac est. Quisque sit amet risus nulla. Quisque vestibulum posuere velit, vitae vestibulum eros scelerisque sit amet. In in risus est, at laoreet dolor. Nullam aliquet pellentesque convallis. Ut vel tincidunt nulla. Mauris auctor tincidunt auctor.
        </Paragraph>
    </RichTextBlock>
    <RichTextBlockOverflow x:Name="firstOverflowContainer" Grid.Column="1" Margin="20,0"
                           OverflowContentTarget="{Binding ElementName=secondOverflowContainer}"/>
    <RichTextBlockOverflow x:Name="secondOverflowContainer" Grid.Column="2" Margin="20,0"/>
</Grid>

Constructors

RichTextBlockOverflow() RichTextBlockOverflow() RichTextBlockOverflow()

Initializes a new instance of the RichTextBlockOverflow class.

public RichTextBlockOverflow()public RichTextBlockOverflow()Public Sub New()
Attributes

Properties

BaselineOffset BaselineOffset 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.

public double BaselineOffset { get; }public double BaselineOffset { get; }Public ReadOnly Property BaselineOffset As double
Value
double double double

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

Attributes

ContentEnd ContentEnd ContentEnd

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

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

A TextPointer that indicates the end of content in the RichTextBlockOverflow.

Attributes

ContentSource ContentSource ContentSource

Gets the RichTextBlock content source of this RichTextBlockOverflow.

public RichTextBlock ContentSource { get; }public RichTextBlock ContentSource { get; }Public ReadOnly Property ContentSource As RichTextBlock
Value
RichTextBlock RichTextBlock RichTextBlock

The content source for this RichTextBlockOverflow.

Attributes

Remarks

This is a calculated property that is reflective of how OverflowContentTarget is set.

ContentStart ContentStart ContentStart

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

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

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

Attributes

HasOverflowContent HasOverflowContent HasOverflowContent

Gets a value that indicates whether the RichTextBlockOverflow has content that extends beyond its bounds, that can provide content to an OverflowContentTarget element.

public bool HasOverflowContent { get; }public bool HasOverflowContent { get; }Public ReadOnly Property HasOverflowContent As bool
Value
bool bool bool

True if the RichTextBlockOverflow has content that extends beyond its bounds; otherwise, false.

Attributes

Remarks

If HasOverflowContent is true and the OverflowContentTarget property is set, the extra content flows into the OverflowContentTarget element.

HasOverflowContentProperty HasOverflowContentProperty HasOverflowContentProperty

Identifies the HasOverflowContent dependency property.

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

The identifier for the HasOverflowContent dependency property.

Attributes

MaxLines MaxLines MaxLines

Gets or sets the maximum lines of text shown in the RichTextBlockOverflow.

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

The maximum lines of text shown in the RichTextBlockOverflow. The default is 0, which is a special value that represents "Auto" behavior. The value cannot be negative.

Attributes

Remarks

Use the MaxLines property to specify the maximum lines of text shown in a text block. The text control will adjust it’s height to show no more than the specified number of lines, regardless of the font size, font style, or text length.

Negative integer values are invalid, and will cause a run-time exception.

MaxLinesProperty MaxLinesProperty MaxLinesProperty

Identifies the MaxLines dependency property.

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

The identifier for the MaxLines dependency property.

Attributes

OverflowContentTarget OverflowContentTarget OverflowContentTarget

Gets or sets a reference to another RichTextBlockOverflow that is the linked target for any text overflow from this RichTextBlockOverflow.

public RichTextBlockOverflow OverflowContentTarget { get; set; }public RichTextBlockOverflow OverflowContentTarget { get; set; }Public ReadWrite Property OverflowContentTarget As RichTextBlockOverflow
RichTextBlockOverflow OverflowContentTarget="{Binding ElementName=nameOfTarget}" />
Attributes

OverflowContentTargetProperty OverflowContentTargetProperty OverflowContentTargetProperty

Identifies the OverflowContentTarget dependency property.

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

The identifier for the OverflowContentTarget dependency property.

Attributes

Padding Padding 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 RichTextBlockOverflow.

public Thickness Padding { get; set; }public Thickness Padding { get; set; }Public ReadWrite Property Padding As Thickness
<RichTextBlockOverflow Padding="uniform"/>
- or -
<RichTextBlockOverflow Padding="left&Right,top&Bottom"/>
- or -
<RichTextBlockOverflow Padding="left,top,right,bottom"/>
Value
Thickness Thickness Thickness

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

Attributes

Remarks

RichTextBlock also has a Padding property, therefore the padding applied to the RichTextBlockOverflow can be different than on the RichTextBlock associated with it. The padding on the overflow won't default to the value from the associated RichTextBlock, so you'll have to set it manually if you want the same padding on each.

A related property is Margin (a property of FrameworkElement ). For more info about the relationship between margin and padding, see Alignment, margin, and padding or Define layouts with XAML.

See Also

PaddingProperty PaddingProperty PaddingProperty

Identifies the Padding dependency property.

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

The identifier for the Padding dependency property.

Attributes

Methods

Focus(FocusState) Focus(FocusState) Focus(FocusState)

Focuses the RichTextBlockOverflow, as if it were a conventionally focusable control.

public bool Focus(FocusState value)public bool Focus(FocusState value)Public Function Focus(value As FocusState) As bool
Parameters
value
FocusState FocusState FocusState

Specifies the desired target for focus state, as a value of the enumeration.

Returns
bool bool bool

true if focus was set to the RichTextBlockOverflow, or focus was already there. false if the RichTextBlockOverflow is not focusable.

Attributes

Remarks

GetPositionFromPoint(Point) GetPositionFromPoint(Point) GetPositionFromPoint(Point)

Returns a TextPointer text reference from a RichTextBlockOverflow by hit-testing a specific Point within the text display area.

public TextPointer GetPositionFromPoint(Point point)public TextPointer GetPositionFromPoint(Point point)Public Function GetPositionFromPoint(point As Point) As TextPointer
Parameters
point
Point Point Point

The point to test.

Returns

The determined text reference.

Attributes

See Also