What you did in Hello WPF isn't much different from what you could have done in Windows Forms. There are a few differences, however, even in this simple application, which aren't readily apparent. For example, run the program again, and try stretching out the borders of the window, as shown in Figure 19-4.
Notice how the "Say Hello" button stretches as you stretch the window. That wouldn't happen in Windows Forms without some extra tweaking on your part (you can load one of the examples from Chapter 18 if you want to check that). In fact, the label stretches too, but you can't see that because the
Label control has no border, and it's the same color as the background.
Figure 19-4. When you stretch the window in WPF, the controls stretch with it.
If the button doesn't stretch for you, you probably have the button placed too far to one side of the window, so the margin is set to zero. Go back to the Design view and move the button until you see the arrows connecting the left and right sides of the button to the sides of the window.
Close the application and go back to the Window1.xaml window to see how that happened. Expand the XAML part of the window so that you can see it better. You'll find that it looks something like Example 19-1, although the actual values will probably be different in your case.
Example 19-1. The XAML for your Hello WPF application ...