Wednesday, March 16, 2011

WPF UniformGrid

Hey guys welcome to WPF Tutorials! Today we are going to talk about the Uniform Grid in WPF!

Transcript from the Video:

What does it do?
So, what does the Uniform Grid do? It simply provides a way to create a grid where all of the cells are the same size! Hence the name UniformGrid.

How do we use it?
So let’s test what I just said, we are going to add a couple of rectangles.
So, 1 rectangle, 1 cell they’re all on of them are the same size.
So, 2 rectangle, 2 rectangles that are the same size.
3rd one... same size...

*Now Show Row and Column*
So what if we want to lay out a specific number of rows and columns? All we have to do is use the Row Attribute and a Column attribute! So here I say I want a UniformGrid with 3 columns and 3 rows.

And with the right amount of logic we could actually go so far as to create a board game or something with it.

So we can name the uniformGrid as checkerboard. Then in the code behind we can specify that it has 7 columns and 7 rows. Then loop through and add Black and Red squares to the grid!

When we run it should look something like a checkerboard. Now all you would need to do is add some simple logic to add pieces and rules and all that fun stuff!


  1. Hey Bro thanks for this video ........

    - Amey Raut

  2. Checkerboard have 8x8 :)
    otherwise - great simple movie! thanks!

  3. What happens when adding number of controls more than cells?