Search

Saturday, September 7, 2013
0 comments

Introduction of ListView Control: WPF

9:47 PMSaturday, September 7, 2013
I have discussed about Listbox control introduction, its binding with grid resource and a list of string, in my previous posts. Now the next is ListView control, which is inherited by the listbox class. It means it have all the features of listbox and included some new features also.

ListView control provides some layouts to display the data bound to it. A simple listview, with some width and height, can be coded by following XAML code:

<ListView Name="listView" Height="300" Width="200" />

A listview can contain any type of items, it may be string, a class or it may be from database. We can show some items as same as in listbox control like:
<ListView Name="listView" Height="300" Width="200" >
<ListView.Items>
<ListViewItem>First Item</ListViewItem>
<ListViewItem>Second Item</ListViewItem>
<ListViewItem>Third Item</ListViewItem>
<ListViewItem>Fourth Item</ListViewItem>
</ListView.Items>
</ListView>

The above XAML code will add a listview with four items as shown in following image. In the image no items have been selected. We can select the item with IsSelected property to true, the more containing this property to true, the more will get selected.

ListView control introduction in WPF C#

When we talk about the properties, it have much more like listbox and some extra i.e. View, which is used to define the infrastructure for the data. We can show the data in tabular format using gridview control in the view mode of listview control. In the next article we will bind this listview control.
Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top