TreeNodeBinding.ToolTipField Propriedade
Definição
Obtém ou define o nome do campo da fonte de dados a ser associado à propriedade ToolTip de um objeto TreeNode ao qual o objeto TreeNodeBinding é aplicado.Gets or sets the name of the field from the data source to bind to the ToolTip property of a TreeNode object to which the TreeNodeBinding object is applied.
public:
property System::String ^ ToolTipField { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string ToolTipField { get; set; }
[System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string ToolTipField { get; set; }
[<System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.ToolTipField : string with get, set
[<System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.ToolTipField : string with get, set
Public Property ToolTipField As String
Valor da propriedade
O nome do campo a ser associado à ToolTip propriedade de um TreeNode objeto ao qual o TreeNodeBinding objeto é aplicado.The name of the field to bind to the ToolTip property of a TreeNode object to which the TreeNodeBinding object is applied. O padrão é uma cadeia de caracteres vazia (""), que indica que a propriedade ToolTipField não está definida.The default is an empty string (""), which indicates that the ToolTipField property is not set.
- Atributos
Exemplos
Esta seção contém dois exemplos de código.This section contains two code examples. O primeiro exemplo de código demonstra como usar a ToolTipField propriedade para especificar qual atributo de um elemento XML associar à ToolTip propriedade de um TreeNode objeto ao qual o TreeNodeBinding objeto é aplicado.The first code example demonstrates how to use the ToolTipField property to specify which attribute of an XML element to bind to the ToolTip property of a TreeNode object to which the TreeNodeBinding object is applied. O segundo exemplo de código fornece dados XML de exemplo para o primeiro exemplo de código.The second code example provides sample XML data for the first code example.
O exemplo a seguir demonstra como usar a ToolTipField propriedade para especificar qual atributo de um elemento XML associar à ToolTip propriedade de um TreeNode objeto ao qual o TreeNodeBinding objeto é aplicado.The following example demonstrates how to use the ToolTipField property to specify which attribute of an XML element to bind to the ToolTip property of a TreeNode object to which the TreeNodeBinding object is applied. Para que este exemplo funcione corretamente, você deve copiar os dados XML de exemplo, fornecidos após este exemplo de código, para um arquivo chamado Booklist.xml.For this example to work correctly, you must copy the sample XML data, provided after this code example, to a file named 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 TextField, ImageUrlField, NavigateUrlField, -->
<!-- ValueField, and ToolTipField 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"
TextField="Text"
ImageUrlField="Image"
ImageToolTipField="ImageToolTip"
NavigateUrlField="Nav"
ValueField="Value"
ToolTipField="Tip"/>
<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 TextField, ImageUrlField, NavigateUrlField, -->
<!-- ValueField, and ToolTipField 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"
TextField="Text"
ImageUrlField="Image"
ImageToolTipField="ImageToolTip"
NavigateUrlField="Nav"
ValueField="Value"
ToolTipField="Tip"/>
<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>
O exemplo de código a seguir fornece dados XML de exemplo para o exemplo de código anterior.The following code example provides sample XML data for the preceding code example.
<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>
Comentários
Quando o TreeView controle está associado a uma fonte de dados, use a ToolTipField propriedade para especificar o nome do campo a ser associado à ToolTip propriedade de um TreeNode objeto.When the TreeView control is bound to a data source, use the ToolTipField property to specify the field name to bind to the ToolTip property of a TreeNode object. Essa relação de associação afeta todos os TreeNode objetos aos quais o TreeNodeBinding objeto é aplicado.This binding relationship affects all TreeNode objects to which the TreeNodeBinding object is applied. O texto da dica de ferramenta é exibido quando o ponteiro do mouse está posicionado sobre o nó.The ToolTip text is displayed when the mouse pointer is positioned over the node.
Observação
Você pode substituir seletivamente a ToolTipField Propriedade definindo a ToolTip propriedade de cada nó diretamente.You can selectively override the ToolTipField property by setting the ToolTip property of each node directly.
Em vez de usar a ToolTipField propriedade para associar a ToolTip propriedade de um TreeNode objeto a um campo, você pode definir a ToolTip propriedade como um valor fixo definindo a ToolTip propriedade.Instead of using the ToolTipField property to bind the ToolTip property of a TreeNode object to a field, you can set the ToolTip property to a fixed value by setting the ToolTip property.
Observação
Se a fonte de dados contiver vários campos, você deverá primeiro definir a Depth propriedade ou ou DataMember ambas as propriedades para associar ao campo apropriado.If the data source contains multiple fields, you must first set the Depth or DataMember property, or both properties in order to bind to the appropriate field.
O valor dessa propriedade é armazenado em estado de exibição.The value of this property is stored in view state.