Sunday, January 07, 2007

WPF - How to distinguish a Grid from a Table

Recently, while perusing the WPF reference documentation, I noticed that WPF provides both a Grid and a Table control. I was very interested in comparing and contrasting the two as initially, I believed the two were almost synonymous. However, neither control provides the complete functionality of the other. This posting will help you learn how to distinguish between a Grid and a Table. Alot of this information is available from the Grid definition page on MSDN.

A Grid provides the following features over the Table:

  • Element can be inserted by row and column indexes.
  • Content can be layered within a single cell.
  • Children can be relatively positioned to an upper-left corner of a cell

A Table provides the following features over the Grid:
  • Built-in support for paging
  • Built-in support for table headers
  • Built-in support for table footers.

Essentially, a Grid is used for Layout and a Table is used Data. If you know of other differences, please post them in the comments and I will be glad to update this post.

1 comment:

Anonymous said...

Table is FrameworkContentElement

in contrast

Grid is FrameworkElement

Grid is Layout, which is inherited from Panel,

Table not.