Ritesh
Ritesh

Reputation: 362

Bullet or number is placed at bottom of ListItem in WPF RichTextBox

I am creating a Bullet/Numbered List in WPF RichTextBox. If the content of ListItem grows, the bullet/number is displayed at vertical bottom.

<List MarkerStyle="Decimal">
    <ListItem>
        <Paragraph>Hello</Paragraph>
    </ListItem>
    <ListItem>
        <Paragraph>Hi</Paragraph>
    </ListItem>
    <ListItem>
        <Paragraph>
            <Image Source="C:\my images\image.png" />
        </Paragraph>
    </ListItem>
    <ListItem>
        <Paragraph>Fourth</Paragraph>
    </ListItem>
</List>

The output of this code can be found here - https://i.sstatic.net/5Q5uk.png

You can see that Number 3 is displayed at bottom instead of top.

How can I move the position of number/bullet at top of item?

Thank you in advance.

Upvotes: 1

Views: 907

Answers (1)

Ritesh
Ritesh

Reputation: 362

Got the solution. We can use Span tag with BaseAlignment property.

<ListItem>
    <Paragraph>
        <Span BaselineAlignment="Center">
            <Image Source="C:\Users\Public\Pictures\Sample Pictures\desert.jpg" />
        </Span>
    </Paragraph>
</ListItem>

Posting here for help of others.

Ritesh

Upvotes: 2

Related Questions