GridControl.View Property

Gets or sets the grid's view. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.dll

Declaration

public DataViewBase View { get; set; }
Public Property View As DataViewBase

Property Value

Type Description
DataViewBase

A DataViewBase descendant that specifies the grid view used to display data.

Remarks

TIP

Topic: Views

The GridControl does not actually display data itself. It uses a View to display data from the bound data source. A View specifies how records and record fields are arranged.

<dxg:GridControl AutoGenerateColumns="AddNew" ItemsSource="{Binding Customers}" >
    <dxg:GridControl.View>
        <dxg:TableView />
    </dxg:GridControl.View>
    <dxg:GridColumn FieldName="Name" Width="3*"/>
    <dxg:GridColumn FieldName="City" Width="3*"/>
    <dxg:GridColumn FieldName="Visits" Width="*"/>
    <dxg:GridColumn FieldName="BirthDate" Width="2*"/>
</dxg:GridControl> 

When the GridControl is created, it initializes the View property with a TableView object. To display data using a Card View, you should create a corresponding View object and assign it to the View property. To display hierarchical data in a tree, use the TreeListView.

<dxg:GridControl ItemsSource="{Binding Employees}">
    <dxg:GridControl.View>
        <dxg:TreeListView KeyFieldName="ID" ParentFieldName="ParentID"/>
    </dxg:GridControl.View>
    <dxg:GridColumn FieldName="Name"/>
    <dxg:GridColumn FieldName="Position"/>
    <dxg:GridColumn FieldName="Department"/>
</dxg:GridControl> 
See Also