Chessboard in WPF

CaptainProton picture CaptainProton · Dec 27, 2009 · Viewed 8.7k times · Source

For years I've developed with Winforms, now I want to switch to WPF and make a chessboard. Unfortunately I have no idea where to start. Using WPF makes me very unsure, I'm feeling like a noob again. Can someone outline a basic design? I guess I would start with a 8x8 Grid and use rectangles for the squares, images for pieces. And then? Am I missing something?

Edit: It's just about the user interface; what goes on behind the scenes is no problem.

Answer

Alastair Pitts picture Alastair Pitts · Dec 27, 2009

An alternative to the standard grid, is the use of a UniformGrid (msdn link).

It's probably more suited to this (in my opinion) as it will ALWAYS give you the same size cells.

used ala:

<UniformgGrid Columns="8" Rows="8">
    <Control1/>
    <Control2/>
    <Control3/>
</UniformGrid>

any of these answers will give you the results you desire.