O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

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

Arranging controls vertically

Pages often contain many controls that must be arranged in some way. One of the most natural ways is arranging them vertically, one below another. This linear method is supported by the StackPanel control. In this recipe, you will learn how to use it to prepare the page with a registration form consisting of a few other controls, namely TextBlock, TextBox, PasswordBox, ComboBox, CheckBox, and Button.

Getting ready

To step through this recipe, you only need the automatically generated project.

How to do it...

To arrange controls vertically to create a simple registration form, modify the content of the MainPage.xaml file as follows:

    <Page (...)> 
        <StackPanel Background="White" Padding="20"> <TextBlock Text="Create an account" ...

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