RichTextBlockOverflow RichTextBlockOverflow RichTextBlockOverflow Class

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.

Syntax

Declaration

public sealed class RichTextBlockOverflowpublic sealed class RichTextBlockOverflowPublic NotInheritable Class RichTextBlockOverflow
<RichTextBlockOverflow .../>

Inheritance Hierarchy

Inherited Members

Inherited properties

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Tag
Tag
Tag
, , , , , , , , , , , , , , , , , , , , , , , , ,

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 summary

Initializes a new instance of the RichTextBlockOverflow class.

Properties summary

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.

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

Gets the RichTextBlock content source of this RichTextBlockOverflow.

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

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

Identifies the HasOverflowContent dependency property.

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

Identifies the MaxLines dependency property.

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

Identifies the OverflowContentTarget dependency property.

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.

Identifies the Padding dependency property.

Methods summary

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

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

Constructors

  • RichTextBlockOverflow()
    RichTextBlockOverflow()
    RichTextBlockOverflow()
    RichTextBlockOverflow()

    Initializes a new instance of the RichTextBlockOverflow class.

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

Properties

  • BaselineOffset
    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 doublepublic double BaselineOffset { get; }

    Property Value

    • double
      double
      double

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

  • ContentEnd
    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 TextPointerpublic TextPointer ContentEnd { get; }

    Property Value

  • ContentSource
    ContentSource
    ContentSource
    ContentSource

    Gets the RichTextBlock content source of this RichTextBlockOverflow.

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

    Property Value

    Remarks

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

  • ContentStart
    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 TextPointerpublic TextPointer ContentStart { get; }

    Property Value

  • HasOverflowContent
    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 boolpublic bool HasOverflowContent { get; }

    Property Value

    • bool
      bool
      bool

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

    Remarks

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

  • HasOverflowContentProperty
    HasOverflowContentProperty
    HasOverflowContentProperty
    HasOverflowContentProperty

    Identifies the HasOverflowContent dependency property.

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

    Property Value

  • MaxLines
    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 intpublic int MaxLines { get; set; }
    <RichTextBlockOverflow MaxLines="int"/>
    

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

    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
    MaxLinesProperty

    Identifies the MaxLines dependency property.

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

    Property Value

  • OverflowContentTarget
    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 RichTextBlockOverflowpublic RichTextBlockOverflow OverflowContentTarget { get; set; }
    RichTextBlockOverflow OverflowContentTarget="{Binding ElementName=nameOfTarget}" />
    

    Property Value

  • OverflowContentTargetProperty
    OverflowContentTargetProperty
    OverflowContentTargetProperty
    OverflowContentTargetProperty

    Identifies the OverflowContentTarget dependency property.

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

    Property Value

  • Padding
    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 Thicknesspublic Thickness Padding { get; set; }
    <RichTextBlockOverflow Padding="uniform"/>
    - or -
    <RichTextBlockOverflow Padding="left&Right,top&Bottom"/>
    - or -
    <RichTextBlockOverflow Padding="left,top,right,bottom"/>
    

    Property Value

    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.

  • PaddingProperty
    PaddingProperty
    PaddingProperty
    PaddingProperty

    Identifies the Padding dependency property.

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

    Property Value

Methods

  • Focus(FocusState)
    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 boolpublic bool Focus(FocusState value)

    Parameters

    Returns

    Remarks

  • GetPositionFromPoint(Point)
    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 TextPointerpublic TextPointer GetPositionFromPoint(Point point)

    Parameters

    Returns

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute
Windows.Foundation.Metadata.WebHostHiddenAttribute

Details

Assembly

Windows.UI.Xaml.Controls.dll