HyperLinkDataBindingHandler.DataBindControl メソッド
アセンブリ: System.Design (system.design.dll 内)

Dim instance As HyperLinkDataBindingHandler Dim designerHost As IDesignerHost Dim control As Control instance.DataBindControl(designerHost, control)

このメソッドは、HyperLink コントロールの Text プロパティと NavigateUrl プロパティがデータ連結されているかどうかを確認します。Text プロパティがデータ連結されている場合、このメソッドはプロパティの値を "DataBound" に設定します。NavigateUrl プロパティがデータ連結されている場合、このメソッドはプロパティの値をテキスト文字列に設定して、コントロールに有効なハイパーリンクのような外観を持たせます。

HyperLinkDataBindingHandler クラスから派生する CustomHyperLinkDataBindingHandler という名前のクラスを作成するコードの例を次に示します。このコードは、CustomHyperLink クラスの ImageUrl プロパティのデザイン時のデータ連結を解決します。これにより、このクラスがデザイン時にデータ連結された場合にこのプロパティのプレースホルダ テキストが表示されます。
' Derive a class from the HyperLinkDataBindingHandler. It will ' resolve data binding for the CustomHyperlink at design time. Public Class CustomHyperLinkDataBindingHandler Inherits HyperLinkDataBindingHandler ' Override the DataBindControl to set property values in ' the DataBindingCollection at design time. Public Overrides Sub DataBindControl( _ ByVal designerHost As IDesignerHost, ByVal control As Control) Dim bindings As DataBindingCollection = _ CType(control, IDataBindingsAccessor).DataBindings Dim imageBinding As DataBinding = bindings("ImageUrl") If Not (imageBinding Is Nothing) Then Dim hLink As CustomHyperLink = CType(control, CustomHyperLink) hLink.ImageUrl = "Image URL." End If MyBase.DataBindControl(designerHost, control) End Sub ' DataBindControl End Class ' CustomHyperLinkDataBindingHandler
// Derive a class from the HyperLinkDataBindingHandler. It will // resolve data binding for the CustomHyperlink at design time. public class CustomHyperLinkDataBindingHandler : HyperLinkDataBindingHandler { // Override the DataBindControl to set property values in // the DataBindingCollection at design time. public override void DataBindControl(IDesignerHost designerHost, Control control) { DataBindingCollection bindings = ((IDataBindingsAccessor)control).DataBindings; DataBinding imageBinding = bindings["ImageUrl"]; // If Text is empty, supply a default value. if (!(imageBinding == null)) { CustomHyperLink hype = (CustomHyperLink)control; hype.ImageUrl = "Image URL."; } // Call the base method to bind the control. base.DataBindControl(designerHost, control); } // DataBindControl } // CustomHyperLinkDataBindingHandler


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHyperLinkDataBindingHandler.DataBindControl メソッドを検索する場合は、下記のリンクをクリックしてください。

- HyperLinkDataBindingHandler.DataBindControl メソッドのページへのリンク