O'Reilly logo

Microsoft® Silverlight® Edition: Programming Windows® Phone 7 by Charles Petzold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Single-Cell Grid Clone

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required