$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
ListView WinForms Control
Create functional user interfaces, group, filter, sort, and customize data items
Home > WinForms UI Controls > User Manual > Get Started ListView in C# in C#

How to Use ListView WinForms Control

Kettic ListView .NET control enables the users to bind to data items from data source and display these data items in pages or individually. This ListView WinForms control is also able to group, filter, sort, and customize data items in C#.NET template projects as well as create elegant and functional user interfaces. In the article, we are going to demonstrate the basic capabilities of ListView control for data item processing in C#.NET.

How to Use ListView Control

In this tutorial, we will use the DataTable included in the Data Demo folder. The data items including ProductName, Category, Price, and ProductImage will be applied in the process as below.
In this example, we need to create a form by using the Kettic CommandBar and the Kettic ListView. And then add a strip to Kettic CommandBar and populate the CommandBar with the items as following.
  • Text: "Sort By:"
  • Name: commandBarDropDownSort
  • Text: ""
  • Items: None, Price, ProductName, Category
  • Text: "Group By:"
  • Name: commandBarDropDownGroup
  • Text: ""
  • Items: None, Category, ProductName
  • Name: commandBarToggleButtonList
  • ToolTipText: "ListView"
  • Image: Some image representing ListView
  • Name: commandBarToggleButtonTiles
  • ToolTipText: "IconsView"
  • Image: Some image representing IconsView
  • Name: commandBarToggleButtonDetails
  • ToolTipText: "DetailsView"
  • Image: Some image representing DetailsView
  • Name: commandBarTextBoxFilter
  • Text: ""
When we have done the steps above, we can configure the data source for the ListView control. In this step, we need to enable the data editing and remove functionalities, and subscribe to the events that will be used in the sample.
In this step, we can open the event handler for the ItemDataBound event and handle the events subscribed. Here, we will set the corresponding item image from data source to the ListViewDataItem
Now, we can customize the visual item by handling the FormatVisualItem event. We need to assign the visual item image and set visual item text to ProductName, Category, and Price for IconsView
After that, we can customize the appearance of the grid cells by handling the FormatCell event through the DetailsView in Kettic ListView.
When we create a column in the ListView, the CreateColumn event will be fired. This event is able to hide the unwanted columns and create custom columns with more user friendly headers.
The final event is ChangedViewType, which will be fired when the ViewType is changed. This event is able to set view specific settings. There are three methods available to handle the event, SetupDetailsView, SetupIconsView, and SetupSimpleListView. In the event handler, simply check the new view and call the corresponding method.
In this step, we are able to fill up the Kettic CommandBar element and handle the toggle buttons. We need to subscribe the ChangedToggleState event and the ChangeToggleState event of the CommandBarToggleButtons to handle the view changing buttons.
Then, Add the sorting functionality by subscribing to the ChangedSelectedIndex event and add the desired SortDescriptors from the selected item in the drop down
Add the grouping functionality by subscribing to the ChangedSelectedIndex event of commandBarDropDownGroup and add the desired GroupDescriptors from the selected item in the drop down.
Add the filtering feature by subscribing to the the TextChanged event of commandBarTextBoxFilterCommandBarTextBox and add FilterDescriptor from the text entered in the text box.
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