Version

ContextMenuItems Property

Specifies the menu items that should be displayed in the context menu when in edit mode.
Syntax
'Declaration
 
Public Property ContextMenuItems As FormattedTextMenuItems
public FormattedTextMenuItems ContextMenuItems {get; set;}
Example
The following code shows some of the properties and methods used for edit operations.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports Infragistics.Win.FormattedLinkLabel

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' By default the right-click context menu displays a subset of options supported
        ' by the formatted text editor. You can control which options get displayed in
        ' the context menu using the ContextMenuItems property.
        Me.ultraFormattedTextEditor1.ContextMenuItems = FormattedTextMenuItems.All

        ' You may want to prevent the control from hiding selection whenever it looses
        ' focus. Set HideSelection to false for that.
        Me.ultraFormattedTextEditor1.HideSelection = False

        ' PerformAction can be used to perform keyboard actions. This would be useful
        ' for example if you had toolbar buttons for performing certain operations that
        ' are also supported by the built-in key actions.
        Me.ultraFormattedTextEditor1.PerformAction(FormattedLinkEditorAction.ToggleBold, False, False)

        ' EditInfo property returns an object that can be used to perform various edit
        ' related operations.
        Dim editInfo As FormattedTextEditInfo = Me.ultraFormattedTextEditor1.EditInfo

        ' Set the editor's value to some formatted text for testing purposes.
        Me.ultraFormattedTextEditor1.Value = "Test <b>Value</b>."

        ' Select some contents.
        editInfo.SelectionStart = 5
        editInfo.SelectionLength = 5

        ' Make the selected contents into a link.
        editInfo.MakeSelectionIntoLink("<a href=""http:://www.infragistics.com""></a>")

        ' Apply some style on the selected content. Please consult help for a listing of
        ' supported style attributes.
        editInfo.ApplyStyle("font-size: +8pt; font-family: Courier New; background-color: Yellow", False)

        ' Use the Value property to get the new formatted text from the editor. Since
        ' Value property is object type, simply call ToString to convert it to a string.
        Dim newFormattedText As String = Me.ultraFormattedTextEditor1.Value.ToString()

        ' Print out the new value.
        Debug.WriteLine("New formatted text = " & newFormattedText)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;
using Infragistics.Win.FormattedLinkLabel;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			// By default the right-click context menu displays a subset of options supported
			// by the formatted text editor. You can control which options get displayed in
			// the context menu using the ContextMenuItems property.
			this.ultraFormattedTextEditor1.ContextMenuItems = FormattedTextMenuItems.All;

			// You may want to prevent the control from hiding selection whenever it looses
			// focus. Set HideSelection to false for that.
			this.ultraFormattedTextEditor1.HideSelection = false;

			// PerformAction can be used to perform keyboard actions. This would be useful
			// for example if you had toolbar buttons for performing certain operations that
			// are also supported by the built-in key actions.
			this.ultraFormattedTextEditor1.PerformAction( FormattedLinkEditorAction.ToggleBold, false, false );

			// EditInfo property returns an object that can be used to perform various edit
			// related operations.
			FormattedTextEditInfo editInfo = this.ultraFormattedTextEditor1.EditInfo;

			// Set the editor's value to some formatted text for testing purposes.
			this.ultraFormattedTextEditor1.Value = "Test <b>Value</b>.";

			// Select some contents.
			editInfo.SelectionStart = 5;
			editInfo.SelectionLength = 5;
			
			// Make the selected contents into a link.
			editInfo.MakeSelectionIntoLink( @"<a href=""http://www.infragistics.com""></a>" );

			// Apply some style on the selected content. Please consult help for a listing of
			// supported style attributes.
			editInfo.ApplyStyle( "font-size: +8pt; font-family: Courier New; background-color: Yellow", false );

			// Use the Value property to get the new formatted text from the editor. Since
			// Value property is object type, simply call ToString to convert it to a string.
			string newFormattedText = this.ultraFormattedTextEditor1.Value.ToString( );

			// Print out the new value.
			Debug.WriteLine( "New formatted text = " + newFormattedText );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also