WPF makes it easy to use graphics in your applications and the ability to develop your graphics card more easily. There are many aspects of the graphical framework to achieve this goal. One of the most important is the synthesis.
7.1.1 synthesis
Graphical elements can be grouped into any part of your user interface. Many GUI technologies are easy to isolate graphics into an independent world. This requires a "joystick"--when moving a world of buttons, text boxes and other frames into shape and image in another world, because in many systems, the two worlds have different programming models.
For example, cocoa of Windows forms and Mac OS provide the ability to arrange controls in a form, and to create a program that interacts with those controls. They also provide APIs that provide advanced, fully scalable 2-D space drawing tools. (For GDI + in Windows Forms, Quartz 2D in OS X.) However, these drawing APIs are different from the control APIs. The drawing base is very different from the controls in these systems, and you can't mix these two freely.
WPF, on the other hand, takes shape as an element in the UI tree, just like any other element. Therefore, we are free to mix them in any type of element. Example 7-1 shows a variety of examples.
Example 7-1
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock>Mix</TextBlock>
<Rectangle Fill="Red" Width="20" />
<TextBlock>text</TextBlock>
<Ellipse Fill="Blue" Width="40" />
<TextBlock>and</TextBlock>
<Button>Controls</Button>
</StackPanel>
<Ellipse DockPanel.Dock="Left" Fill="Green" Width="100" />
<Button DockPanel.Dock="Left">Foo</Button>
<TextBlock FontSize="24" TextWrap="Wrap">
And of course you can put graphics into
your text: <Ellipse Fill="Cyan" Width="50" Height="20" />
</TextBlock>
</DockPanel>
As you can see, the graphical elements are added to the tag without gaps. Look and work together-just as it does with any other element, the result is shown in Figure 7-1.
Figure 7-1