Tab
A newer version of this page is available. Switch to the current version.

MenuItem.TextTemplate Property

Gets or sets a template used for displaying the text content of the current menu item.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(null)]
public virtual ITemplate TextTemplate { get; set; }
<DefaultValue(Nothing)>
Public Overridable Property TextTemplate As ITemplate

Property Value

Type Default Description
ITemplate

null

An object supporting the ITemplate interface which contains the template used for displaying the menu item's text content.

Remarks

Use the TextTemplate property to control the contents of the current menu item. The template defined using this property replaces the text content of an individual menu item - in particular, the item's text specified.

Note that any style settings defined for the menu item via specific properties (such as the ASPxMenuBase.ItemStyle or ASPxMenuBase.SubMenuItemStyle, etc) are still in effect for the menu item whose content is specified through using the TextTemplate property.

In order to define the common text content for all menu items within a menu control, the menu's ASPxMenuBase.ItemTextTemplate property can be used. A template for the client regions of submenus can be specified via the ASPxMenuBase.SubMenuTemplate or MenuItem.SubMenuTemplate property.

NOTE

Once a template defined via the TextTemplate property is created within a tab control, it is instantiated within a container object of the MenuItemTemplateContainer type. This container object exposes a set of specific properties to which the template's child controls can be bound.

NOTE

An TextTemplate cannot contain another menu control.

Examples

This example illustrates how to create a TextTemplate and assign it to MenuItem at runtime.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using DevExpress.Web.ASPxEditors;
using System.