TreeNodeBinding.ImageToolTipField Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur nama bidang dari sumber data untuk mengikat properti ImageToolTipTreeNode objek tempat TreeNodeBinding objek diterapkan.
public:
property System::String ^ ImageToolTipField { 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 ImageToolTipField { get; set; }
[System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string ImageToolTipField { get; set; }
[<System.ComponentModel.TypeConverter("System.Web.UI.Design.DataSourceViewSchemaConverter, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
member this.ImageToolTipField : 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.ImageToolTipField : string with get, set
Public Property ImageToolTipField As String
Nilai Properti
Nama bidang yang akan diikat ke ImageToolTip properti TreeNode objek tempat TreeNodeBinding objek diterapkan. Defaultnya adalah string kosong (""), yang menunjukkan bahwa ImageToolTipField properti tidak diatur.
- Atribut
Contoh
Bagian ini berisi dua contoh kode. Contoh kode pertama menunjukkan cara menggunakan ImageToolTipField properti untuk menentukan atribut elemen XML mana yang akan diikat ke ImageToolTip properti TreeNode objek tempat TreeNodeBinding objek diterapkan. Contoh kode kedua menyediakan contoh data XML untuk contoh kode pertama.
Contoh berikut menunjukkan cara menggunakan ImageToolTipField properti untuk menentukan atribut elemen XML mana yang akan diikat ke ImageToolTip properti TreeNode objek tempat TreeNodeBinding objek diterapkan. Agar contoh ini berfungsi dengan benar, Anda harus menyalin data XML sampel, yang disediakan setelah contoh kode ini, ke file bernama 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>
Contoh kode berikut menyediakan contoh data XML untuk contoh kode sebelumnya.
<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>
Keterangan
TreeView Saat kontrol terikat ke sumber data, gunakan ImageToolTipField properti untuk menentukan nama bidang yang akan diikat ke ImageToolTip properti TreeNode objek. Teks yang Anda tentukan menyediakan perangkat Teknologi Bantuan dengan deskripsi gambar yang dapat digunakan untuk membuat kontrol lebih mudah diakses.
Hubungan pengikatan ini memengaruhi semua TreeNode objek tempat TreeNodeBinding objek diterapkan. Saat gambar ditampilkan di samping simpul, teks TipsAlat ditampilkan saat penunjuk mouse diposisikan di atas gambar.
Nota
Anda dapat secara selektif mengambil alih ImageToolTipField properti dengan mengatur ImageToolTip properti setiap simpul secara langsung.
Alih-alih menggunakan ImageToolTipField properti untuk mengikat ImageToolTip properti TreeNode objek ke bidang, Anda dapat mengatur ImageToolTip properti ke nilai tetap dengan mengatur ImageToolTip properti .
Nota
Jika sumber data berisi beberapa bidang, Anda harus terlebih dahulu mengatur Depth properti atau DataMember , atau kedua properti untuk mengikat ke bidang yang sesuai.
Nilai properti ini disimpan dalam status tampilan.