Perhaps the simplest panel of all is the Grid that contains no rows or columns, commonly referred to as a “single-cell Grid.” I’ve been using the Grid named ContentPanel as a single-cell Grid; as you’ve seen, the Grid can host multiple children, but they overlap within the same area.
Let’s duplicate the functionality of a single-cell Grid with a class named SingleCellGrid.
In a new project named SingleCellGridDemo, I right-clicked the project name, selected Add and New Item from the menu, and picked Class from the dialog box, naming it SingleCellGrid.cs. In the file, I made sure the class was public and derived from Panel.
Example 9-11. Silverlight Project: SingleCellGridDemo File: SingleCellGrid.cs (excerpt)
namespace SingleCellGridDemo ...