460
LESSON 40 Making WPF aPPlications
3. Add five Image controls. Set their properties. (In particular, set Stretch to Uniform and set
their
Source properties.)
4. If you like, move common Image properties into a style.
Please select Lesson 40 on the DVD to view the video that accompanies this lesson.
EXERCISES
1. Copy the program you built for this lesson’s Try It and replace the StackPanel with a
WrapPanel. (Hint: Instead of removing the StackPanel and all the controls that it con-
tains and then rebuilding everything inside a
WrapPanel, edit the XAML code and replace
the
StackPanel element with a WrapPanel element. Be sure to also change the closing
</StackPanel> tag.) Run the program and see what happens if you make the program’s
window taller and narrower.
2. Make the program shown in Figure 40-5. Replace the
initially created
Grid with a UniformGrid. Set the new
control’s
Rows property to 2 and its Columns property
to 3.
Add a button to the UniformGrid. Then add a
LayoutTransform property to it as shown in the
following code:
<Button Content=”Switch User” Height=”23” Width=”75”>
<Button.LayoutTransform>
<RotateTransform Angle=”-20”/>
</Button.LayoutTransform>
</Button>
Copy and paste this button several times and edit each button’s Content property to deter-
mine the text it displays.
If you like, experiment with the
UniformGrid’s background brush and move common prop-
erties into a style.
You can download the solutions to these exercises from the book’s web page at
www.wrox.com or www.CSharpHelper.com/24hour.html. You can find them in
the Lesson40 folder of the download.
FIGURE 405
596906c40.indd 460 4/7/10 12:35:22 PM
Click here to Play