ListView.View Property

Gets or sets an object that defines how the data is styled and organized in a ListView control.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public ViewBase View { get; set; }
/** @property */
public ViewBase get_View ()

/** @property */
public void set_View (ViewBase value)

public function get View () : ViewBase

public function set View (value : ViewBase)

For XAML information, see the ViewBase type.

Property Value

A ViewBase object that specifies how to display information in the ListView.

Identifier field


Metadata properties set to true


The .NET Framework 3.0 environment includes the configurable view mode named GridView. You can also create a custom view that inherits from ViewBase. For more information, see How to: Create a Custom View for a ListView.

The following example shows how to specify a GridView object as the View for a ListView control. For the complete sample, see ListView with Sorting Sample.


  <GridView AllowsColumnReorder="true"
            ColumnHeaderToolTip="Employee Information">

    <GridViewColumn DisplayMemberBinding=
                        "{Binding Path=FirstName}" 
                    Header="First Name" Width="100"/>
    <GridViewColumn DisplayMemberBinding=
                        "{Binding Path=LastName}" 
                    Header="Last Name" Width="100"/>
    <GridViewColumn DisplayMemberBinding=
                        "{Binding Path=EmployeeNumber}" 
                    Header="Employee No." Width="100"/>


ListView myListView = new ListView();

GridView myGridView = new GridView();
myGridView.AllowsColumnReorder = true; 
myGridView.ColumnHeaderToolTip = "Employee Information";

GridViewColumn gvc1 = new GridViewColumn();
gvc1.DisplayMemberBinding = new Binding("FirstName");
gvc1.Header = "FirstName";
gvc1.Width = 100;
GridViewColumn gvc2 = new GridViewColumn();
gvc2.DisplayMemberBinding = new Binding("LastName");
gvc2.Header = "Last Name";
gvc2.Width = 100;
GridViewColumn gvc3 = new GridViewColumn();
gvc3.DisplayMemberBinding = new Binding("EmployeeNumber");
gvc3.Header = "Employee No.";
gvc3.Width = 100;

//ItemsSource is ObservableCollection of EmployeeInfo objects
myListView.ItemsSource = new myEmployees();
myListView.View = myGridView;

More Code

How to: Display ListView Contents by Using a GridView

This example shows how to define a GridView view mode for a ListView control.

How to: Create a Custom View Mode for a ListView

This example shows how to create a custom View mode for a ListView control.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions