15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1000 ❘ ChaPTer 35 cOre wpf<br />

<br />

Button<br />

<br />

<br />

You can see the child controls of the StackPanel organized vertically<br />

in Figure 35-13.<br />

WrapPanel<br />

The WrapPanel positions the children from left to right, one after<br />

the other, as long as they fit into the line, <strong>and</strong> then continues<br />

with the next line. The orientation of the panel can be horizontal<br />

or vertical:<br />

<br />

<br />

Button<br />

Button<br />

Button<br />

Button<br />

Button<br />

Button<br />

Button<br />

Button<br />

<br />

<br />

Figure 35-14 shows the output of the panel. If you resize the<br />

application, then the buttons will be rearranged so that they fit<br />

into a line.<br />

Canvas<br />

Canvas is a panel that allows you to explicitly position<br />

controls. Canvas defines the attached properties Left, Right,<br />

Top, <strong>and</strong> Bottom that can be used by the children for positioning<br />

within the panel:<br />

code snippet LayoutDemo/StackPanelWindow.xaml<br />

code snippet LayoutDemo/WrapPanelWindow.xaml<br />

figure 35-14<br />

figure 35-13<br />

<br />

<br />

Enter here:<br />

<br />

<br />

<br />

<br />

code snippet LayoutDemo/CanvasWindow.xaml<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!