// create a paragraph settings with no top and bottom spacing
ParagraphSettings listParagraphSettings = new ParagraphSettings();
listParagraphSettings.Spacing = new ParagraphSpacingSettings()
{
AfterParagraph = new ParagraphVerticalSpacing(
new Extent(0, ExtentUnitType.LogicalPixels)),
BeforeParagraph = new ParagraphVerticalSpacing(
new Extent(0, ExtentUnitType.LogicalPixels)),
};
// create a list template with one level definition which is using
// decimals, bold style and red color for the numbering
ListTemplate redListTemplate = new ListTemplate()
{
LevelDefinitions = new ListLevelDefinitionCollection()
{
new ListLevelDefinition()
{
Level = 0,
LevelText = "FORGET %1",
NumberFormat = NumberFormat.DecimalEnclosedFullstop,
NumberSuffix = NumberSuffix.Space,
NumberSettings = new CharacterSettings ()
{
Bold = true,
Color = new ColorInfo(Colors.Red)
},
ParagraphSettings = listParagraphSettings,
}
}
};
// create list style using the template
ListStyle redListStyle = new ListStyle()
{
Id = "MyRedListStyle",
Template = redListTemplate
};
this.xamRichTextEditor1.Document.RootNode.Styles.Add(redListStyle);
// create a rich text list using the list style
RichTextList redRichTextList = new RichTextList()
{
Id = "MyRedRichTextList",
ListStyleId = "MyRedListStyle"
};
this.xamRichTextEditor1.Document.RootNode.Lists.Add(redRichTextList);