Archie
Archie

Reputation: 2579

Difference between datagrid and grid in wpf

What is the difference between DataGrid (not GridView) and Grid controls in wpf?

Upvotes: 24

Views: 25990

Answers (2)

CodeWarrior
CodeWarrior

Reputation: 7468

You can think of the Grid as a combination of the Windows Forms background layout and a spreadsheet (in that you can have rows and columns) into which you can add controls and position them.

The Grid view is a View element that can be used in a ListView control to display data from database, XML or even CLR objects, in columns and rows with column headers and row indicators, similar to (but not exactly like) the DataGrid control in Windows Forms. GridView is only really usable as part of a ListView AFAIK.

So something like this:

<ListView>
    <ListView.View>
        <GridView/>
    </ListView.View>
</ListView>

Cory

Upvotes: 0

ChrisF
ChrisF

Reputation: 137148

A Grid is a control for laying out other controls on the form (or page).

A DataGrid is a control for displaying tabular data as read from a database for example.

Upvotes: 36

Related Questions