You need to set the ITextParagraphFormat.ListType property for ITextParagraphFormat. For the bullet, set the ListType property to MarkerType.Bullet , for the number, set the ListType parameter to MarkerType.Arabic . For more information, see the MarkerType section to select other types of lists that you want.
Here is an example of adding a bullet and a number to a selected paragraph list in a RichEditBox that you can check.
XAML Code
<RichEditBox x:Name="Richbox" Height="400" Margin="40" > </RichEditBox> <Button x:Name="BtnSetbullet" Content="set bullet to richeditbox" Click="BtnSetbullet_Click"></Button> <Button x:Name="BtnSetNumber" Content="set number to richeditbox" Click="BtnSetNumber_Click"></Button>
Code for
private void BtnSetbullet_Click(object sender, RoutedEventArgs e) { Windows.UI.Text.ITextSelection selectedText = Richbox.Document.Selection; ITextParagraphFormat paragraphFormatting = selectedText.ParagraphFormat; paragraphFormatting.ListType = MarkerType.Bullet; selectedText.ParagraphFormat = paragraphFormatting; } private void BtnSetNumber_Click(object sender, RoutedEventArgs e) { Windows.UI.Text.ITextSelection selectedText = Richbox.Document.Selection; ITextParagraphFormat paragraphFormatting = selectedText.ParagraphFormat; paragraphFormatting.ListType = MarkerType.Arabic; selectedText.ParagraphFormat = paragraphFormatting; }
source share