- Online Barcode Generator
- How To
- Buy Now
ListView Control Data Binding in C#.NET
Kettic ListView .NET control is capable of binding to data source to display those data. There are three properties available for the users to bind ListView to data, the DataSource, ShowMember, and ValueMember. The DataSource property is used to specify the data source that the ListView will be bound to, the ShowMember displays the specific data in a ListView, and the ValueMember returns the value of a ListView from the specific data.
How to Configure DataBinding Properties
The DataSource property can be configured either in the Properties windows or in the Smart Tag menu of Kettic ListView control. The following steps show how to the DataSource and ValueMember and ValueMember properties.
How to Customize Columns in ListView in C#.NET
After we bind the Kettic ListView control to a collection of business objects and choose the ViewType to be DetailsView, the columns will display the values of all the properties of the business objects. We can customize the column size, viability, and other properties by handling the CreateColumn event. The C# code below shows how to create columns in C#.NET.
How to Bind ListView to Data in C#.NET
The guide below shows how to bind a ListView component to a list of business objects in C#.NET project. We will create a business object first and the custom object will implement the ChangedINotifyProperty interface. After that, we can create a collection of our business objects by using the C# code below.
To bind the Kettic ListView control to this collection, we can simply configure the properties, DataSource, DisplayMember and ValueMember by using the C# code below.
After setting these properties, we will get the Kettic ListView populated with items that display the value Name property and the ID property of the business object returned as value. We can see them via opening an item for editing.
To extend the functionality of the case, we can handle the ItemDataBound event, which will be fired after assigning the ListViewDataItem an object from the data bound. We can access the data bound object properties in the event handler and assign an image to the item by using the C# code below.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls