TreeNodeBinding.ToolTip プロパティ

定義

TreeNodeBinding オブジェクトが適用されるノードのツールヒント テキストを取得または設定します。

public:
 property System::String ^ ToolTip { System::String ^ get(); void set(System::String ^ value); };
public string ToolTip { get; set; }
member this.ToolTip : string with get, set
Public Property ToolTip As String

プロパティ値

String

TreeNodeBinding オブジェクトが適用されるノードのツールヒント テキスト。 既定値は空の文字列 ("") です。ToolTip プロパティが設定されていないことを示します。

このセクションには、2 つのコード例が含まれています。 最初のコード例では、プロパティを ToolTip 使用して、オブジェクトが適用されるノードのツールヒント テキストを指定する方法を TreeNodeBinding 示します。 2 番目のコード例では、最初のコード例のサンプル XML データを提供します。

次の例では、プロパティを ToolTip 使用して、オブジェクトが適用されるノードのツールヒント テキストを指定する方法を TreeNodeBinding 示します。 この例を正しく機能させるには、このコード例の後に提供されるサンプル XML データを、Booklist.xmlという名前のファイルにコピーする必要があります。


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeViewBinding Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeViewBinding Example</h3>
    
      <!-- Set the Text, ImageUrl, ImageToolTip, -->
      <!-- NavigateUrl, Value, and ToolTip       -->
      <!-- properties of a TreeNodeBinding       -->
      <!-- object declaratively.                 -->   
      <asp:TreeView id="BookTreeView" 
        DataSourceID="BookXmlDataSource"
        Target="_blank" 
        runat="server">
          
        <DataBindings>
          <asp:TreeNodeBinding DataMember="Books" 
            Depth="0" 
            TextField="Text"/>
          <asp:TreeNodeBinding DataMember="Book" 
            Depth="1" 
            Text="Book Title" 
            ImageUrl="Image.jpg"
            ImageToolTip="Book Image" 
            NavigateUrl="http://www.microsoft.com" 
            Value="BookID" 
            ToolTip="Book Information"/>
          <asp:TreeNodeBinding DataMember="Description" 
            Depth="2" 
            TextField="Text"/>
          <asp:TreeNodeBinding DataMember="Price" 
            Depth="2" 
            TextField="Value"/>
        </DataBindings>
         
      </asp:TreeView>
      
      <asp:XmlDataSource id="BookXmlDataSource"  
        DataFile="Booklist.xml"
        runat="server">
      </asp:XmlDataSource>
    
    </form>
  </body>
</html>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>TreeViewBinding Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeViewBinding Example</h3>
    
      <!-- Set the Text, ImageUrl, ImageToolTip, -->
      <!-- NavigateUrl, Value, and ToolTip       -->
      <!-- properties of a TreeNodeBinding       -->
      <!-- object declaratively.                 -->   
      <asp:TreeView id="BookTreeView" 
        DataSourceID="BookXmlDataSource"
        Target="_blank" 
        runat="server">
          
        <DataBindings>
          <asp:TreeNodeBinding DataMember="Books" 
            Depth="0" 
            TextField="Text"/>
          <asp:TreeNodeBinding DataMember="Book" 
            Depth="1" 
            Text="Book Title" 
            ImageUrl="Image.jpg"
            ImageToolTip="Book Image" 
            NavigateUrl="http://www.microsoft.com" 
            Value="BookID" 
            ToolTip="Book Information"/>
          <asp:TreeNodeBinding DataMember="Description" 
            Depth="2" 
            TextField="Text"/>
          <asp:TreeNodeBinding DataMember="Price" 
            Depth="2" 
            TextField="Value"/>
        </DataBindings>
         
      </asp:TreeView>
      
      <asp:XmlDataSource id="BookXmlDataSource"  
        DataFile="Booklist.xml"
        runat="server">
      </asp:XmlDataSource>
    
    </form>
  </body>
</html>

次のコード例では、前のコード例のサンプル XML データを提供します。

<Books Text="Books List">  
    <Book Text="Book Title One"  
        Value="1"   
        Image="Bookimage1.jpg"  
        ImageToolTip="Book 1 Photo"   
        Nav="http://www.microsoft.com"  
        Tip="Book Title 1">  
        <Description Text="Book Description">  
        </Description>  
        <Price Value="$1.99">  
        </Price>  
        <Author Text="Author Name"  
            Value="LastName"   
            Image="Authorimage1.jpg"   
            Nav="http://www.microsoft.com"  
            Tip="Author Name">  
        </Author>  
    </Book>  
    <Book Text="Book Title Two"  
        Value="2"   
        Image="Bookimage2.jpg"  
        ImageToolTip="Book 2 Photo"   
        Nav="http://www.microsoft.com"  
        Tip="Click Me">  
        <Description Text="Book Description">  
        </Description>  
        <Price Value="$2.99">  
        </Price>  
        <Author Text="Author Name"  
            Value="LastName"   
            Image="Authorimage2.jpg"   
            Nav="http://www.microsoft.com"  
            Tip="Author Name">  
        </Author>  
    </Book>  
</Books>  

注釈

コントロールがTreeViewデータ ソースにバインドされている場合は、プロパティをToolTip使用して、オブジェクトのプロパティにバインドする値をToolTipTreeNode指定します。 このバインディング リレーションシップは、オブジェクトが適用されるすべての TreeNode オブジェクトに TreeNodeBinding 影響します。 マウス ポインターがノード上に配置されると、ツールヒントテキストが表示されます。

注意

各ノードのプロパティを ToolTip 直接設定することで、プロパティを ToolTip 選択的にオーバーライドできます。

プロパティを ToolTip 使用して同じツールヒント テキストを各ノードにバインドする代わりに、プロパティを ToolTip 設定することで、オブジェクトの TreeNode プロパティをデータ ソースのフィールドに ToolTipField バインドできます。

このプロパティの値は、ビューステートに格納されます。

このプロパティの値を設定すると、デザイナー ツールを使用してリソース ファイルに自動的に保存できます。 詳細については、「グローバリゼーションとローカリゼーション」を参照してくださいLocalizableAttribute

適用対象

こちらもご覧ください