バージョン

Items プロパティ (ToolbarDropDown)

ドロップダウンで項目を現在管理するために使用されているコレクションを返します。
シンタックス
'宣言
 
Public ReadOnly Property Items As ToolbarDropDownItemCollection
public ToolbarDropDownItemCollection Items {get;}

プロパティ値

ドロップダウンのToolbarDropDownItems型を管理するToolbarDropDownCollection。
解説

このコレクションのメンバーを使用してドロップダウンの項目を構成/管理します。

使用例
'--------------------
' Note: custom buttons with all their properties can be created within aspx.
' That would reduce size of hidden viewstate field and improve persistance of properties.
' To generate toolbar items at visual design,- the editor for Toolbar property can be used.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		If (Me.IsPostBack) Then
			Return
		End If

		'-------------------
		' Add another item to a build-in Insert drop-down list
		Dim dropDownInsert As ToolbarDropDown = CType(Me.WebHtmlEditor1.FindByKeyOrAction("Insert"), ToolbarDropDown)
		If (Not dropDownInsert Is Nothing) Then
			dropDownInsert.Items.Add(New ToolbarDropDownItem("Signature2", "<span style='background-color:red'>My Signature<span>"))
		End If

		'-------------------
		' Add another item to the Style (font-style) drop-down list.
		' Note: commented line below shows example to remove default items from list.
		' Me.WebHtmlEditor1.FontStyleList.Clear()
		Dim dropDownFont As ToolbarDropDown = CType(Me.WebHtmlEditor1.FindByKeyOrAction("FontStyle"), ToolbarDropDown)
		If (Not dropDownFont Is Nothing) Then
			dropDownFont.Items.Add(New ToolbarDropDownItem("40px", "font-size:40px"))
		End If

		'-------------------
		' Add a custom button with custom action.
		' Note: implementation of actual action requires processing ClientSideEvents.BeforeAction
		Dim customAction As ToolbarButton = New ToolbarButton()
		customAction.Key = "MyCustomAct"
		customAction.Type = ToolbarButtonType.Custom
		Me.WebHtmlEditor1.Toolbar.Items.Add(customAction)
End Sub


To process custom actions on client, application should set
<ClientSideEvents BeforeAction="WebHtmlEditor1_BeforeAction" />
and codes below should appear within the HEAD section of HTML.

<script type="text/javascript">
<!--
// function fired before actions
function WebHtmlEditor1_BeforeAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8)
{
	// if it is our custom MyCustomAct toolbar button,
	// then insert text at the current selection in editor
	if(actID == "MyCustomAct")
	{
		iged_insText("My Custom Action");
	}
}
// -->
</script>
//--------------------
	// Note: custom buttons with all their properties can be created within aspx.
	// That would reduce size of hidden viewstate field and improve persistance of properties.
	// To generate toolbar items at visual design,- the editor for Toolbar property can be used.
	protected void Page_Load(object sender, EventArgs e)
	{
		if(this.IsPostBack)
			return;

		//-------------------
		// Add another item to a built-in Insert drop-down list
		ToolbarDropDown dropDownInsert = this.WebHtmlEditor1.FindByKeyOrAction("Insert") as ToolbarDropDown;
		if(dropDownInsert != null)
		{
			dropDownInsert.Items.Add(new ToolbarDropDownItem("Signature2", "<span style='background-color:red'>My Signature<span>"));
		}

		//-------------------
		// Add another item to the Style (font-style) drop-down list
		// Note: commented line below shows example to remove default items from list
		// this.WebHtmlEditor1.FontStyleList.Clear();
		ToolbarDropDown dropDownFont = this.WebHtmlEditor1.FindByKeyOrAction("FontStyle") as ToolbarDropDown;
		if(dropDownFont != null)
		{
			dropDownFont.Items.Add(new ToolbarDropDownItem("40px", "font-size:40px"));
		}

		//-------------------
		// Add a custom button with custom action.
		// Note: implementation of actual action requires processing ClientSideEvents.BeforeAction
		ToolbarButton customAction = new ToolbarButton();
		customAction.Key = "MyCustomAct";
		customAction.Type = ToolbarButtonType.Custom;
		this.WebHtmlEditor1.Toolbar.Items.Add(customAction);
	}

To process custom actions on client, application should set
<ClientSideEvents BeforeAction="WebHtmlEditor1_BeforeAction" />
and codes below should appear within the HEAD section of HTML.

<script type="text/javascript">
<!--
// function fired before actions
function WebHtmlEditor1_BeforeAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8, act)
{
	// if it is our custom MyCustomAct toolbar button,
	// then insert text at the current selection in editor
	if(actID == "MyCustomAct")
	{
		iged_insText("My Custom Action");
	}
}
// -->
</script>
参照