ListControlDataBindingHandler.DataBindControl メソッド
アセンブリ: System.Design (system.design.dll 内)
構文Dim instance As ListControlDataBindingHandler Dim designerHost As IDesignerHost Dim control As Control instance.DataBindControl(designerHost, control)
解説control によって指定された ListControl コントロールが、DataBindings プロパティで指定されたデータ ソースを持つ場合、DataBindControl メソッドは、ListControl の Items コレクションをクリアし、ListControl が Items コレクションにデータ バインドされていることを示す文字列メッセージを追加します。
使用例DataBindControl メソッドをオーバーライドして、このコントロールがデータ バインドされたときに関連付けられている SimpleRadioButtonList コントロールに文字列メッセージを追加する方法を次のコード例に示します。
このコード例は、ListControlDataBindingHandler クラスのトピックで取り上げているコード例の一部分です。
' Override the DataBindControl. Public Overrides Sub DataBindControl( _ ByVal designerHost As IDesignerHost, _ ByVal control As Control) ' Create a reference, named dataSourceBinding, ' to the control's DataSource binding. Dim dataSourceBinding As DataBinding _ = CType( _ control, _ IDataBindingsAccessor).DataBindings("DataSource") ' If the binding exists, create a reference to the ' list control, clear its ListItemCollection, and then add ' an item to the collection. If Not (dataSourceBinding Is Nothing) Then Dim simpleControl As SimpleRadioButtonList = _ CType(control, SimpleRadioButtonList) simpleControl.Items.Clear() simpleControl.Items.Add("Data-bound Radio Button.") End If End Sub ' DataBindControl
// Override the DataBindControl. public override void DataBindControl(IDesignerHost designerHost, Control control) { // Create a reference, named dataSourceBinding, // to the control DataSource binding. DataBinding dataSourceBinding = ((IDataBindingsAccessor)control).DataBindings["DataSource"]; // If the binding exists, create a reference to the // list control, clear its ListItemCollection, and then add // an item to the collection. if (! (dataSourceBinding == null)) { SimpleRadioButtonList simpleControl = (SimpleRadioButtonList)control; simpleControl.Items.Clear(); simpleControl.Items.Add("Data-bound Radio Button."); } } // DataBindControl
.NET Framework のセキュリティ
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- ListControlDataBindingHandler.DataBindControl メソッドのページへのリンク