Command Bars Customization Example for WPF

Nevron NOV RichTextEditor for WPF ships with hundreds of examples with full source code, as part of the Nevron Open Vision Suite. All WPF RichTextEditor examples are also available as a stand-alone Visual Studio solution in C# and VB.NET, which you can download from the links below.

Command Bars Customization Example for WPF Description

This example demonstrates how to customize the NOV rich text command bars (menus and toolbars).


Command Bars Customization Example

C# Command Bars Customization Example Code for Nevron RichTextEditor for WPF
Language: C#

using Nevron.Nov;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.Text;
using Nevron.Nov.Text.Commands;
using Nevron.Nov.Text.UI;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System.Windows.Forms;

namespace NovWinFormsProject
{
	public partial class Form1 : Form
	{
		#region Constructors

		public Form1()
		{
			InitializeComponent();

			// Set form title
			Text = "NOV WinForms - NCommandBarsCustomizationExample";

			// Create the NOV example and its controls
			NWidget exampleContent = CreateExampleContent();
			NWidget exampleControls = CreateExampleControls();
			if (exampleControls != null)
			{
				exampleControls.PreferredWidth = 300;
			}

			// Place the example and its controls in a pair box
			NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
			pairBox.FillMode = ENStackFillMode.First;
			pairBox.FitMode = ENStackFitMode.First;
			pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);

			// Host the example in the form
			NNovWidgetHost host = new NNovWidgetHost(pairBox);
			host.Dock = DockStyle.Fill;
			Controls.Add(host);
		}

		#endregion

		#region Example

		public NWidget CreateExampleContent()
		{
			m_RichText = new NRichTextView();
			m_RichText.AcceptsTab = true;
			m_RichText.Content.Sections.Clear();

			// Populate the rich text
			PopulateRichText();

			// Add the custom command action to the rich text view's commander
			m_RichText.Commander.Add(new CustomCommandAction());

			// Remove the "Edit" menu and insert a custom one
			m_CommandBarBuilder = new NRichTextCommandBarBuilder();
			m_CommandBarBuilder.MenuDropDownBuilders.Remove(NLoc.Get("Edit"));
			m_CommandBarBuilder.MenuDropDownBuilders.Insert(1, new CustomMenuBuilder());

			// Remove the "Standard" toolbar and insert a custom one
			m_CommandBarBuilder.ToolBarBuilders.Remove(NLoc.Get("Standard"));
			m_CommandBarBuilder.ToolBarBuilders.Insert(0, new CustomToolBarBuilder());

			// Create the commanding UI
			NCommandUIHolder richTextViewWithCommandBars = m_CommandBarBuilder.CreateUI(m_RichText);

			// Remove the Open command from the File menu and the page number command from the status bar
			richTextViewWithCommandBars.RemoveCommands(NRichTextView.OpenCommand, NRichTextView.PageNumberStatusBarCommand);

			return richTextViewWithCommandBars;
		}

		public NWidget CreateExampleControls()
		{
			return null;
		}
		public string GetExampleDescription()
		{
			return @"

This example demonstrates how to customize the NOV rich text command bars (menus and toolbars).

"; } /// /// Gets the relevant documentation links for the example /// /// public (string Name, string Url)[] GetDocumentationUrls() { return new[] { ("Rich Text Command Bars via Code", "https://www.nevron.com/docs/openvision/rich-text-command-bars-via-code.html"), ("Rich Text Commanding Overview", "https://www.nevron.com/docs/openvision/rich-text-commanding-overview.html"), }; } private void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Ribbon Customization", "This example demonstrates how to customize the NOV rich text command bars (menus and toolbars).", 1)); } #endregion #region Implementation #endregion #region Event Handlers #endregion #region Fields private NRichTextView m_RichText; private NRichTextCommandBarBuilder m_CommandBarBuilder; #endregion #region Static Methods private static NParagraph GetDescriptionParagraph(string text) { return new NParagraph(text); } private static NParagraph GetTitleParagraphNoBorder(string text, int level) { double fontSize = 10; ENFontStyle fontStyle = ENFontStyle.Regular; switch (level) { case 1: fontSize = 16; fontStyle = ENFontStyle.Bold; break; case 2: fontSize = 10; fontStyle = ENFontStyle.Bold; break; } NParagraph paragraph = new NParagraph(); paragraph.HorizontalAlignment = ENAlign.Left; paragraph.FontSize = fontSize; paragraph.FontStyle = fontStyle; NTextInline textInline = new NTextInline(text); textInline.FontStyle = fontStyle; textInline.FontSize = fontSize; paragraph.Inlines.Add(textInline); return paragraph; } /// /// Gets a paragraph with title formatting /// /// /// private static NParagraph GetTitleParagraph(string text, int level) { NColor color = NColor.Black; NParagraph paragraph = GetTitleParagraphNoBorder(text, level); paragraph.HorizontalAlignment = ENAlign.Left; paragraph.Border = CreateLeftTagBorder(color); paragraph.BorderThickness = defaultBorderThickness; return paragraph; } private static NGroupBlock GetNoteBlock(string text, int level) { NColor color = NColor.Red; NParagraph paragraph = GetTitleParagraphNoBorder("Note", level); NGroupBlock groupBlock = new NGroupBlock(); groupBlock.ClearMode = ENClearMode.All; groupBlock.Blocks.Add(paragraph); groupBlock.Blocks.Add(GetDescriptionParagraph(text)); groupBlock.Border = CreateLeftTagBorder(color); groupBlock.BorderThickness = defaultBorderThickness; return groupBlock; } private static NGroupBlock GetDescriptionBlock(string title, string description, int level) { NColor color = NColor.Black; NParagraph paragraph = GetTitleParagraphNoBorder(title, level); NGroupBlock groupBlock = new NGroupBlock(); groupBlock.ClearMode = ENClearMode.All; groupBlock.Blocks.Add(paragraph); groupBlock.Blocks.Add(GetDescriptionParagraph(description)); groupBlock.Border = CreateLeftTagBorder(color); groupBlock.BorderThickness = defaultBorderThickness; return groupBlock; } /// /// Creates a left tag border with the specified border /// /// /// private static NBorder CreateLeftTagBorder(NColor color) { NBorder border = new NBorder(); border.LeftSide = new NBorderSide(); border.LeftSide.Fill = new NColorFill(color); return border; } private static NParagraph GetLoremIpsumParagraph() { return new NParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum placerat in tortor nec tincidunt. Sed sagittis in sem ac auctor. Donec scelerisque molestie eros, a dictum leo fringilla eu. Vivamus porta urna non ullamcorper commodo. Nulla posuere sodales pellentesque. Donec a erat et tortor viverra euismod non et erat. Donec dictum ante eu mauris porta, eget suscipit mi ultrices. Nunc convallis adipiscing ligula, non pharetra dolor egestas at. Etiam in condimentum sapien. Praesent sagittis pulvinar metus, a posuere mauris aliquam eget."); } #endregion #region Constants public static readonly NCommand CustomCommand = NCommand.Create(typeof(Nevron.Nov.Examples.Text.NCommandBarsCustomizationExample), "CustomCommand", "Custom Command"); #endregion #region Nested Types public class CustomMenuBuilder : NMenuDropDownBuilder { public CustomMenuBuilder() : base("Custom Menu") { } protected override void AddItems(NMenuItemCollection items) { // Add the "Copy" menu item items.Add(CreateMenuItem(Nevron.Nov.Presentation.NResources.Image_Edit_Copy_svg, NRichTextView.CopyCommand)); // Add the custom command menu item items.Add(CreateMenuItem(Nevron.Nov.Graphics.NImage.FromBytes(Nevron.Nov.NConvert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABsElEQVR4AYWTQ7BjQRSGZz3cjM04Y9u2bdu2bdu29bx83jxzvI79z+munDiVW/Vd/Lf/g0aF0MvyeUJT4ipRTsDLb+ImoQ4zhJifEYjBp2jmfAJWAsmTYP/mN9m+SE08WfsVar7PZuPHcajfRI2M68NFEGn6+3wM6jZSovTRyMAgH9jcgDM5v0/E5+ODUbOBCgeX9oAnfiLccRNxf1c/qV3Z1Ed+B7SjFQHOsiAyplHmSjUUuLZZDoYMemKw1F4eHAjX96AAt7l3MIifIDOZP/k1D5kubuxDCcazxvwTAZyBoouyImUykDCJmMjISeTyA+EAbMbjvf1xaFlP7FrYHTvmS7B7UQ+cWNULj/f0o5bCA+Tyh8jSTKFGU4UGzZXBNCOtWm2FrCYgwB8R4DQL4ue2ud3QpLkGOp0uiGYUZM6YDkDipMAAN0WAOgQYN5XYv0crNGyqhoJMCpUGjZqp0am9HuaP42H9EtRCC94LN1m0EkiahDeHB2LNjC5YOaUzHu3uL6uzBZtfhe7G7KDV+M4rEHH2i0KPQlAlMXga60TW8U5sHuEkXEQBcYFoGDr+P5RkQoMvtntjAAAAAElFTkSuQmCC")), CustomCommand)); } } public class CustomToolBarBuilder : NToolBarBuilder { public CustomToolBarBuilder() : base("Custom Toolbar") { } protected override void AddItems(NCommandBarItemCollection items) { // Add the "Copy" button items.Add(CreateButton(Nevron.Nov.Presentation.NResources.Image_Edit_Copy_svg, NRichTextView.CopyCommand)); // Add the custom command button items.Add(CreateButton(Nevron.Nov.Graphics.NImage.FromBytes(Nevron.Nov.NConvert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABsElEQVR4AYWTQ7BjQRSGZz3cjM04Y9u2bdu2bdu29bx83jxzvI79z+munDiVW/Vd/Lf/g0aF0MvyeUJT4ipRTsDLb+ImoQ4zhJifEYjBp2jmfAJWAsmTYP/mN9m+SE08WfsVar7PZuPHcajfRI2M68NFEGn6+3wM6jZSovTRyMAgH9jcgDM5v0/E5+ODUbOBCgeX9oAnfiLccRNxf1c/qV3Z1Ed+B7SjFQHOsiAyplHmSjUUuLZZDoYMemKw1F4eHAjX96AAt7l3MIifIDOZP/k1D5kubuxDCcazxvwTAZyBoouyImUykDCJmMjISeTyA+EAbMbjvf1xaFlP7FrYHTvmS7B7UQ+cWNULj/f0o5bCA+Tyh8jSTKFGU4UGzZXBNCOtWm2FrCYgwB8R4DQL4ue2ud3QpLkGOp0uiGYUZM6YDkDipMAAN0WAOgQYN5XYv0crNGyqhoJMCpUGjZqp0am9HuaP42H9EtRCC94LN1m0EkiahDeHB2LNjC5YOaUzHu3uL6uzBZtfhe7G7KDV+M4rEHH2i0KPQlAlMXga60TW8U5sHuEkXEQBcYFoGDr+P5RkQoMvtntjAAAAAElFTkSuQmCC")), CustomCommand)); } } public class CustomCommandAction : NTextCommandAction { #region Constructors /// /// Default constructor. /// public CustomCommandAction() { } /// /// Static constructor. /// static CustomCommandAction() { CustomCommandActionSchema = NSchema.Create(typeof(CustomCommandAction), NTextCommandAction.NTextCommandActionSchema); } #endregion #region Public Overrides /// /// Gets the command associated with this command action. /// /// public override NCommand GetCommand() { return CustomCommand; } /// /// Executes the command action. /// /// /// public override void Execute(NNode target, object parameter) { INRichTextView richTextView = GetRichTextView(target); NMessageBox.Show("Rich Text Custom Command executed!", "Custom Command", ENMessageBoxButtons.OK, ENMessageBoxIcon.Information); } #endregion #region Schema /// /// Schema associated with CustomCommandAction. /// public static readonly NSchema CustomCommandActionSchema; #endregion } #endregion } }

Download a fully functional C# (.cs) Command Bars Customization Example for WPF Solution

VB.NET Command Bars Customization Example Code for Nevron RichTextEditor for WPF
Language: VB.NET

Imports Nevron.Nov
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.Text
Imports Nevron.Nov.Text.Commands
Imports Nevron.Nov.Text.UI
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Wpf

Class MainWindow

#Region "Constructors"

	Public Sub New()
		' This call is required by the designer.
		InitializeComponent()

		' Add any initialization after the InitializeComponent() call.

		' Set form title
		Title = "NOV WPF - NCommandBarsCustomizationExample"

		' Create the NOV example and its controls
		Dim exampleContent As NWidget = CreateExampleContent()
		Dim exampleControls As NWidget = CreateExampleControls()
		If Not exampleControls Is Nothing Then
			exampleControls.PreferredWidth = 300
		End If

		' Place the example and its controls in a pair box
		Dim pairBox As NPairBox = New NPairBox(exampleContent, exampleControls)
		pairBox.FillMode = ENStackFillMode.First
		pairBox.FitMode = ENStackFitMode.First
		pairBox.Margins = New NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing)

		' Host the example in the form
		Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
		Content = host
	End Sub


#End Region

#Region "Example"

        Public Function CreateExampleContent() As NWidget
            m_RichText = New NRichTextView()
            m_RichText.AcceptsTab = True
            m_RichText.Content.Sections.Clear()

            ' Populate the rich text
            PopulateRichText()

            ' Add the custom command action to the rich text view's commander
            m_RichText.Commander.Add(New CustomCommandAction())

            ' Remove the "Edit" menu and insert a custom one
            m_CommandBarBuilder = New NRichTextCommandBarBuilder()
            m_CommandBarBuilder.MenuDropDownBuilders.Remove(NLoc.Get("Edit"))
            m_CommandBarBuilder.MenuDropDownBuilders.Insert(1, New CustomMenuBuilder())

            ' Remove the "Standard" toolbar and insert a custom one
            m_CommandBarBuilder.ToolBarBuilders.Remove(NLoc.Get("Standard"))
            m_CommandBarBuilder.ToolBarBuilders.Insert(0, New CustomToolBarBuilder())

            ' Create the commanding UI
            Dim richTextViewWithCommandBars = m_CommandBarBuilder.CreateUI(m_RichText)

            ' Remove the Open command from the File menu and the page number command from the status bar
            richTextViewWithCommandBars.RemoveCommands(NRichTextView.OpenCommand, NRichTextView.PageNumberStatusBarCommand)

            Return richTextViewWithCommandBars
        End Function

        Public Function CreateExampleControls() As NWidget
            Return Nothing
        End Function
        Public Function GetExampleDescription() As String
            Return "

This example demonstrates how to customize the NOV rich text command bars (menus and toolbars).

" End Function ''' ''' Gets the relevant documentation links for the example ''' ''' Public Function GetDocumentationUrls() As (String, String)() Return {("Rich Text Command Bars via Code", "https://www.nevron.com/docs/openvision/rich-text-command-bars-via-code.html"), ("Rich Text Commanding Overview", "https://www.nevron.com/docs/openvision/rich-text-commanding-overview.html")} End Function Private Sub PopulateRichText() Dim section As NSection = New NSection() m_RichText.Content.Sections.Add(section) section.Blocks.Add(GetDescriptionBlock("Ribbon Customization", "This example demonstrates how to customize the NOV rich text command bars (menus and toolbars).", 1)) End Sub #End Region #Region "Implementation" #End Region #Region "Event Handlers" #End Region #Region "Fields" Private m_RichText As NRichTextView Private m_CommandBarBuilder As NRichTextCommandBarBuilder #End Region #Region "Static Methods" Private Shared Function GetDescriptionParagraph(text As String) As NParagraph Return New NParagraph(text) End Function Private Shared Function GetTitleParagraphNoBorder(text As String, level As Integer) As NParagraph Dim fontSize As Double = 10 Dim fontStyle = ENFontStyle.Regular Select Case level Case 1 fontSize = 16 fontStyle = ENFontStyle.Bold Case 2 fontSize = 10 fontStyle = ENFontStyle.Bold End Select Dim paragraph As NParagraph = New NParagraph() paragraph.HorizontalAlignment = ENAlign.Left paragraph.FontSize = fontSize paragraph.FontStyle = fontStyle Dim textInline As NTextInline = New NTextInline(text) textInline.FontStyle = fontStyle textInline.FontSize = fontSize paragraph.Inlines.Add(textInline) Return paragraph End Function ''' ''' Gets a paragraph with title formatting ''' ''' ''' Private Shared Function GetTitleParagraph(text As String, level As Integer) As NParagraph Dim color = NColor.Black Dim paragraph = GetTitleParagraphNoBorder(text, level) paragraph.HorizontalAlignment = ENAlign.Left paragraph.Border = CreateLeftTagBorder(color) paragraph.BorderThickness = defaultBorderThickness Return paragraph End Function Private Shared Function GetNoteBlock(text As String, level As Integer) As NGroupBlock Dim color = NColor.Red Dim paragraph = GetTitleParagraphNoBorder("Note", level) Dim groupBlock As NGroupBlock = New NGroupBlock() groupBlock.ClearMode = ENClearMode.All groupBlock.Blocks.Add(paragraph) groupBlock.Blocks.Add(GetDescriptionParagraph(text)) groupBlock.Border = CreateLeftTagBorder(color) groupBlock.BorderThickness = defaultBorderThickness Return groupBlock End Function Private Shared Function GetDescriptionBlock(title As String, description As String, level As Integer) As NGroupBlock Dim color = NColor.Black Dim paragraph = GetTitleParagraphNoBorder(title, level) Dim groupBlock As NGroupBlock = New NGroupBlock() groupBlock.ClearMode = ENClearMode.All groupBlock.Blocks.Add(paragraph) groupBlock.Blocks.Add(GetDescriptionParagraph(description)) groupBlock.Border = CreateLeftTagBorder(color) groupBlock.BorderThickness = defaultBorderThickness Return groupBlock End Function ''' ''' Creates a left tag border with the specified border ''' ''' ''' Private Shared Function CreateLeftTagBorder(color As NColor) As NBorder Dim border As NBorder = New NBorder() border.LeftSide = New NBorderSide() border.LeftSide.Fill = New NColorFill(color) Return border End Function Private Shared Function GetLoremIpsumParagraph() As NParagraph Return New NParagraph("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum placerat in tortor nec tincidunt. Sed sagittis in sem ac auctor. Donec scelerisque molestie eros, a dictum leo fringilla eu. Vivamus porta urna non ullamcorper commodo. Nulla posuere sodales pellentesque. Donec a erat et tortor viverra euismod non et erat. Donec dictum ante eu mauris porta, eget suscipit mi ultrices. Nunc convallis adipiscing ligula, non pharetra dolor egestas at. Etiam in condimentum sapien. Praesent sagittis pulvinar metus, a posuere mauris aliquam eget.") End Function #End Region #Region "Constants" Public Shared ReadOnly CustomCommand As NCommand = NCommand.Create(GetType(NCommandBarsCustomizationExample), "CustomCommand", "Custom Command") #End Region #Region "Nested Types" Public Class CustomMenuBuilder Inherits NMenuDropDownBuilder Public Sub New() MyBase.New("Custom Menu") End Sub Protected Overrides Sub AddItems(items As NMenuItemCollection) ' Add the "Copy" menu item items.Add(CreateMenuItem(Presentation.NResources.Image_Edit_Copy_svg, NRichTextView.CopyCommand)) ' Add the custom command menu item items.Add(CreateMenuItem(Nevron.Nov.Graphics.NImage.FromBytes(Nevron.Nov.NConvert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABsElEQVR4AYWTQ7BjQRSGZz3cjM04Y9u2bdu2bdu29bx83jxzvI79z+munDiVW/Vd/Lf/g0aF0MvyeUJT4ipRTsDLb+ImoQ4zhJifEYjBp2jmfAJWAsmTYP/mN9m+SE08WfsVar7PZuPHcajfRI2M68NFEGn6+3wM6jZSovTRyMAgH9jcgDM5v0/E5+ODUbOBCgeX9oAnfiLccRNxf1c/qV3Z1Ed+B7SjFQHOsiAyplHmSjUUuLZZDoYMemKw1F4eHAjX96AAt7l3MIifIDOZP/k1D5kubuxDCcazxvwTAZyBoouyImUykDCJmMjISeTyA+EAbMbjvf1xaFlP7FrYHTvmS7B7UQ+cWNULj/f0o5bCA+Tyh8jSTKFGU4UGzZXBNCOtWm2FrCYgwB8R4DQL4ue2ud3QpLkGOp0uiGYUZM6YDkDipMAAN0WAOgQYN5XYv0crNGyqhoJMCpUGjZqp0am9HuaP42H9EtRCC94LN1m0EkiahDeHB2LNjC5YOaUzHu3uL6uzBZtfhe7G7KDV+M4rEHH2i0KPQlAlMXga60TW8U5sHuEkXEQBcYFoGDr+P5RkQoMvtntjAAAAAElFTkSuQmCC")), CustomCommand)) End Sub End Class Public Class CustomToolBarBuilder Inherits NToolBarBuilder Public Sub New() MyBase.New("Custom Toolbar") End Sub Protected Overrides Sub AddItems(items As NCommandBarItemCollection) ' Add the "Copy" button items.Add(MyBase.CreateButton(Presentation.NResources.Image_Edit_Copy_svg, NRichTextView.CopyCommand)) ' Add the custom command button items.Add(CreateButton(Nevron.Nov.Graphics.NImage.FromBytes(Nevron.Nov.NConvert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABsElEQVR4AYWTQ7BjQRSGZz3cjM04Y9u2bdu2bdu29bx83jxzvI79z+munDiVW/Vd/Lf/g0aF0MvyeUJT4ipRTsDLb+ImoQ4zhJifEYjBp2jmfAJWAsmTYP/mN9m+SE08WfsVar7PZuPHcajfRI2M68NFEGn6+3wM6jZSovTRyMAgH9jcgDM5v0/E5+ODUbOBCgeX9oAnfiLccRNxf1c/qV3Z1Ed+B7SjFQHOsiAyplHmSjUUuLZZDoYMemKw1F4eHAjX96AAt7l3MIifIDOZP/k1D5kubuxDCcazxvwTAZyBoouyImUykDCJmMjISeTyA+EAbMbjvf1xaFlP7FrYHTvmS7B7UQ+cWNULj/f0o5bCA+Tyh8jSTKFGU4UGzZXBNCOtWm2FrCYgwB8R4DQL4ue2ud3QpLkGOp0uiGYUZM6YDkDipMAAN0WAOgQYN5XYv0crNGyqhoJMCpUGjZqp0am9HuaP42H9EtRCC94LN1m0EkiahDeHB2LNjC5YOaUzHu3uL6uzBZtfhe7G7KDV+M4rEHH2i0KPQlAlMXga60TW8U5sHuEkXEQBcYFoGDr+P5RkQoMvtntjAAAAAElFTkSuQmCC")), CustomCommand)) End Sub End Class Public Class CustomCommandAction Inherits NTextCommandAction #Region "Constructors" ''' ''' Default constructor. ''' Public Sub New() End Sub ''' ''' Static constructor. ''' Shared Sub New() CustomCommandActionSchema = NSchema.Create(GetType(CustomCommandAction), NTextCommandActionSchema) End Sub #End Region #Region "Public Overrides" ''' ''' Gets the command associated with this command action. ''' ''' Public Overrides Function GetCommand() As NCommand Return CustomCommand End Function ''' ''' Executes the command action. ''' ''' ''' Public Overrides Sub Execute(target As NNode, parameter As Object) Dim richTextView = GetRichTextView(target) NMessageBox.Show("Rich Text Custom Command executed!", "Custom Command", ENMessageBoxButtons.OK, ENMessageBoxIcon.Information) End Sub #End Region #Region "Schema" ''' ''' Schema associated with CustomCommandAction. ''' Public Shared ReadOnly CustomCommandActionSchema As NSchema #End Region End Class #End Region End Class

Download a fully functional VB.NET (.vb) Command Bars Customization Example for WPF Solution