/// <summary> /// Handles the Click event of the NumberingButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void NumberingButton_Click(object sender, RoutedEventArgs e) { if (richTextBox != null && richTextBox.Selection != null) { ListAdv list = richTextBox.Selection.ParagraphFormat.GetList(); if (list == null || (list != null && list.AbstractList.Levels[richTextBox.Selection.Start.Paragraph.ParagraphFormat.ListFormat.ListLevelNumber].ListLevelPattern != ListLevelPattern.Number && list.AbstractList.Levels[richTextBox.Selection.Start.Paragraph.ParagraphFormat.ListFormat.ListLevelNumber].NumberFormat != "%1.")) { list = new ListAdv(null); list.AbstractList = new AbstractListAdv(null); ListLevelAdv listLevel = new ListLevelAdv(list.AbstractList); listLevel.ListLevelPattern = ListLevelPattern.Arabic; listLevel.NumberFormat = "%1."; listLevel.StartAt = 1; listLevel.CharacterFormat.FontFamily = new FontFamily("Verdana"); listLevel.ParagraphFormat.LeftIndent = 48; listLevel.ParagraphFormat.FirstLineIndent = -24; list.AbstractList.Levels.Add(listLevel); richTextBox.Selection.ParagraphFormat.SetList(list); richTextBox.Selection.ParagraphFormat.ListLevelNumber = 0; } else { richTextBox.Selection.ParagraphFormat.ListLevelNumber = -1; } } }
//---------------------------------------------------------------------------// // Used in Notebook for inserting shape style bullet points // //---------------------------------------------------------------------------// private void ListBulletButton_Click(object sender, RoutedEventArgs e) { // Initializes a new abstract list instance. AbstractListAdv abstractListAdv = new AbstractListAdv(null) { AbstractListId = 1 }; // Defines new Bullet ListLevel instance. ListLevelAdv listLevel = new ListLevelAdv(abstractListAdv); listLevel.ParagraphFormat.LeftIndent = 6d; listLevel.ParagraphFormat.FirstLineIndent = 18d; listLevel.FollowCharacter = FollowCharacterType.Tab; listLevel.ListLevelPattern = ListLevelPattern.Bullet; listLevel.RestartLevel = 0; listLevel.StartAt = 0; // Defines Square bullet. listLevel.NumberFormat = "\uf0a7"; listLevel.CharacterFormat.FontFamily = new System.Windows.Media.FontFamily("Wingdings"); // Defines Arrow Bullet. listLevel.NumberFormat = "\u27a4"; listLevel.CharacterFormat.FontFamily = new System.Windows.Media.FontFamily("Arial Unicode MS"); // Defines Beginning of Bulleted List. listLevel.NumberFormat = "\uf0b7"; listLevel.CharacterFormat.FontFamily = new System.Windows.Media.FontFamily("Symbol"); // Adds list level to abstract list. abstractListAdv.Levels.Add(listLevel); // Adds abstract list to the document. Notebook.Document.AbstractLists.Add(abstractListAdv); // Creates a new list instance. ListAdv listAdv = new ListAdv(null) { ListId = 1, // Sets the abstract list Id for this list. AbstractListId = 1 }; if (Notebook.Selection != null) { LevelOverrideAdv levelOverride = new LevelOverrideAdv(listAdv) { LevelNumber = 0, StartAt = 0 }; listAdv.LevelOverrides.Add(levelOverride); Notebook.Document.Lists.Add(listAdv); Notebook.Selection.ParagraphFormat.SetList(listAdv); Notebook.Selection.ParagraphFormat.ListLevelNumber = 0; } }
//---------------------------------------------------------------------------// // Used in Notebook for inserting number style bullet points // //---------------------------------------------------------------------------// private void ListNumberButton_Click(object sender, RoutedEventArgs e) { // Initializes a new abstract list instance. AbstractListAdv numListAdv = new AbstractListAdv(null) { AbstractListId = 2 }; // Defines new Bullet ListLevel instance. ListLevelAdv listLevel = new ListLevelAdv(numListAdv); listLevel.ParagraphFormat.LeftIndent = 6d; listLevel.ParagraphFormat.FirstLineIndent = 18d; listLevel.FollowCharacter = FollowCharacterType.Tab; listLevel.ListLevelPattern = ListLevelPattern.Number; listLevel.NumberFormat = "%1."; listLevel.RestartLevel = 1; listLevel.StartAt = 1; // Adds list level to abstract list. numListAdv.Levels.Add(listLevel); // Adds abstract list to the document. Notebook.Document.AbstractLists.Add(numListAdv); // Creates a new list instance. ListAdv numlistAdv = new ListAdv(null) { ListId = 2, // Sets the abstract list Id for this list. AbstractListId = 2 }; if (Notebook.Selection != null) { Notebook.Document.Lists.Add(numlistAdv); Notebook.Selection.ParagraphFormat.SetList(numlistAdv); Notebook.Selection.ParagraphFormat.ListLevelNumber = 1; } }