iraSenthil
iraSenthil

Reputation: 11577

How to add elements to WPF grid like HTML table?

I feel attaching elements to Grid after defining row and columns is less intuitive. I understand it gives crisp idea of grids layout when its a complex layout. But when the layout is simple, I feel inline definition like Html's Table is more intuitive.

  1. Does Wpf grid provides inline child element declaration?
  2. Why this type of declaration is favored/default behavior?

Upvotes: 0

Views: 1742

Answers (2)

Steve Greatrex
Steve Greatrex

Reputation: 15999

You can get slightly closer to not defining the rows and columns by using a UniformGrid and then specifying either a number of rows or number of colums. This will then cause child elements to be automatically divided into the specified layout. E.g

<UniformGrid Columns="3">
    <-- 6 children -->
</UniformGrid>

will split the children into a 3x2 evenly sized grid.

If you want to have things like autosizing columns etc then you probably need to look at one of the many DataGrid components out there

Upvotes: 2

Fyodor Soikin
Fyodor Soikin

Reputation: 80744

  1. No
  2. This question is best addressed to the WPF designers. I guess you can get hold of some of them at http://social.msdn.microsoft.com

Upvotes: 0

Related Questions