SiteMapPath.InitializeItem メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SiteMapPath.InitializeItem メソッドの意味・解説 

SiteMapPath.InitializeItem メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

SiteMapNode を表す Web サーバー コントロールSiteMapNodeItem に、ノード機能およびノード指定したテンプレートスタイル基づいて一連のコントロール読み込みます。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Overridable Sub
 InitializeItem ( _
    item As SiteMapNodeItem _
)
Dim item As SiteMapNodeItem

Me.InitializeItem(item)
protected virtual void InitializeItem (
    SiteMapNodeItem item
)
protected:
virtual void InitializeItem (
    SiteMapNodeItem^ item
)
protected void InitializeItem (
    SiteMapNodeItem item
)
protected function InitializeItem (
    item : SiteMapNodeItem
)

パラメータ

item

初期化する SiteMapNodeItem。

解説解説

InitializeItem メソッドは、SiteMapNodeItemType を確認して、その項目が表すノード機能上の型を判別し、その型のノード定義されているテンプレートスタイル適用します。

SiteMapNodeItem の項目の型が Root場合、子コントロールである HyperLink作成され、RootNodeTemplate と RootNodeStyle が適用されます。RootNodeTemplate設定されている場合、ITemplate がノード適用されます。代わりに RootNodeStyle設定されている場合、定義済みの NodeStyle でマージされて適用されます。最後にテンプレートスタイル定義されていない場合基本HyperLink コントロール作成されノードの値で初期化されます

SiteMapNodeItem の項目の型が Current場合、RenderCurrentNodeAsLink の戻り値基づいて、子コントロールである Literal または HyperLink作成されます。その後、CurrentNodeTemplate または CurrentNodeStyle が適用されます。CurrentNodeTemplate設定されている場合ITemplateノード適用されます。代わりに CurrentNodeStyle設定されている場合、定義済みNodeStyleマージされて適用されます。

SiteMapNodeItem の項目の型が Parent場合、子コントロールである HyperLink作成され、NodeTemplate と NodeStyle適用されます。NodeTemplate設定されている場合ITemplateノード適用されます。代わりに NodeStyle設定されている場合、それが適用されます。

最後にSiteMapNodeItem の項目の型が PathSeparator の場合、子コントロールである Literal作成されParentノード型に定義される同一一般規則に従って PathSeparatorTemplate と PathSeparatorStyle が適用されます。

個々SiteMapNodeItem オブジェクト操作するには、InitializeItem メソッドオーバーライドます。SiteMapNodeItem オブジェクト作成し、SiteMapPath コントロール追加する方法について、より広範な制御必要な場合は、CreateControlHierarchy メソッドオーバーライドます。

使用例使用例

InitializeItem メソッドオーバーライドして、SiteMapPath から派生したコントロール機能追加する方法次のコード例示します。このコード例は、SiteMapPath クラストピック取り上げているコード例一部分です。

' Override the InitializeItem method to add a PathSeparator
' and DropDownList to the current node.
Protected Overrides Sub
 InitializeItem(item As SiteMapNodeItem)

   ' The only node that must be handled is the CurrentNode.
   If item.ItemType = SiteMapNodeItemType.Current Then
      Dim hLink As New HyperLink()

      ' No Theming for the HyperLink.
      hLink.EnableTheming = False
      ' Enable the link of the SiteMapPath is enabled.
      hLink.Enabled = Me.Enabled

      ' Set the properties of the HyperLink to
      ' match those of the corresponding SiteMapNode.
      hLink.NavigateUrl = item.SiteMapNode.Url
      hLink.Text = item.SiteMapNode.Title
      If ShowToolTips Then
         hLink.ToolTip = item.SiteMapNode.Description
      End If

      ' Apply styles or templates to the HyperLink here.
      ' ...
      ' ...
      ' Add the item to the Controls collection.
      item.Controls.Add(hLink)

      AddDropDownListAfterCurrentNode(item)
   Else
      MyBase.InitializeItem(item)
   End If
End Sub 'InitializeItem

// Override the InitializeItem method to add a PathSeparator
// and DropDownList to the current node.
protected override void InitializeItem(SiteMapNodeItem
 item) {

    // The only node that must be handled is the CurrentNode.
    if (item.ItemType == SiteMapNodeItemType.Current)
    {
        HyperLink hLink = new HyperLink();

        // No Theming for the HyperLink.
        hLink.EnableTheming = false;
        // Enable the link of the SiteMapPath is enabled.
        hLink.Enabled = this.Enabled;

        // Set the properties of the HyperLink to
        // match those of the corresponding SiteMapNode.
        hLink.NavigateUrl = item.SiteMapNode.Url;
        hLink.Text        = item.SiteMapNode.Title;
        if (ShowToolTips) {
            hLink.ToolTip = item.SiteMapNode.Description;
        }

        // Apply styles or templates to the HyperLink here.
        // ...
        // ...

        // Add the item to the Controls collection.
        item.Controls.Add(hLink);

        AddDropDownListAfterCurrentNode(item);
    }
    else {
        base.InitializeItem(item);
    }
}
// Override the InitializeItem method to add a PathSeparator
// and DropDownList to the current node.
protected void InitializeItem(SiteMapNodeItem
 item)
{
    // The only node that must be handled is the CurrentNode.
    if (item.get_ItemType().Equals(SiteMapNodeItemType.Current))
 {
        HyperLink hLink = new HyperLink();
        // No Theming for the HyperLink.
        hLink.set_EnableTheming(false);
        // Enable the link of the SiteMapPath is enabled.
        hLink.set_Enabled(this.get_Enabled());
        // Set the properties of the HyperLink to 
        // match those of the corresponding SiteMapNode.
        hLink.set_NavigateUrl(item.get_SiteMapNode().get_Url());
        hLink.set_Text(item.get_SiteMapNode().get_Title());
        if (get_ShowToolTips()) {
            hLink.set_ToolTip(item.get_SiteMapNode().get_Description());
        }
        // Apply styles or templates to the HyperLink here.
        // ...
        // ...
        // Add the item to the Controls collection.
        item.get_Controls().Add(hLink);

        AddDropDownListAfterCurrentNode(item);
    }
    else {
        super.InitializeItem(item);
    }   
} //InitializeItem
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からSiteMapPath.InitializeItem メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSiteMapPath.InitializeItem メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSiteMapPath.InitializeItem メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

SiteMapPath.InitializeItem メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SiteMapPath.InitializeItem メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS