WPF

WPF ListView

Jose Leon
Author

The ListView is a control that allows you present data to the user using different layouts. The most common one is showing a table with columns with the information. The ListView inherits from ListBox and in WPF provides a number of features that give it a great deal of extensibility being one of them to present information in different formats. Information or data in the ListView is contained within objects. The most basic one is the ListViewItem object that simply represents and item with a single column ListView.

ListView example

Here’s the code of a ListView sample that contains three basic items in the ListViewItem object:

<listview horizontalalignment="Left" height="100" verticalalignment="Top" width="139">

           <listviewitem content="Bing"></listviewitem>

           <listviewitem content="Yahoo" listviewitem=""></listviewitem>

       

</listview>

As you can see, we’re able to create it using simple XAML markup giving us the advantage to shape the information as we wanted using WPF functionality. In the code below we have the same list but with the items in bold and italics:

<listview horizontalalignment="Left" height="100" verticalalignment="Top" width="139" fontweight="Bold">

           <listviewitem content="Bing"></listviewitem>

           <listviewitem content="Google" fontstyle="Italic"></listviewitem>

           <listviewitem content="Yahoo"></listviewitem>

       

</listview>

                 

features

All posts

  • licensing
  • analytics

Easy .NET Protection

Purchase template