Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement databinding for windows custom control?

Basically, I am confused about how to implement databinding on the control side.

I am trying to write a custom list control in C#, which implements databinding. I want it to end up having similar functionality to the ListView, but with an interface similar to ListBox.
I have a private nested class called "ListRow" which handles rendering of each row. There is an internal binding source which gets changes from the data and causes the control to invalidate if necessary. The problem now is that I want to add a checkbox to the ListRow, and I am not sure the best way to implement it so that the underlying object's property gets changed.

like image 377
Tim Avatar asked Jul 27 '10 14:07

Tim


People also ask

How do I enable data binding in Visual Studio?

Open a design surface in the editor and choose View > Data Sources. Add a data source to your project. Set the control that is created when you drag an item from the Data Sources window to the designer. Modify the list of controls that are associated with items in the Data Sources window.

What is DataBinding in VB net?

Description. Simple data binding. The ability of a control to bind to a single data element, such as a value in a column in a dataset table. Simple data binding is the type of binding typical for controls such as a TextBox control or Label control, which are controls that typically only display a single value.

Which one of the following code is implementing two way data binding in asp net?

ASP.NET 2.0 introduces the GridView, FormView, and DetailsView controls, which let you use <%# Bind("FieldName") %> syntax that provides two-way data binding.


1 Answers

try to follow this example. http://www.codeproject.com/KB/database/DataBindCustomControls.aspx

like image 77
Ran Avatar answered Oct 26 '22 16:10

Ran