August 2007
Intermediate to advanced
864 pages
25h 52m
English
Most Windows applications offer toolbars as well as menus. Toolbars provide faster access for frequently used operations, because the user does not need to navigate through the menu system—the toolbar is always visible on-screen. Figure 5-28 shows a pair of typical toolbars.

Figure 5-28. Application with toolbars
WPF supports toolbars through the ToolBarTray and ToolBar controls. ToolBarTray provides a container into which
you can add multiple ToolBar
elements. Example 5-27 shows a simple
example with two toolbars; this is the markup for the toolbars in Figure 5-28.
Example 5-27. ToolBarTray and ToolBar
<ToolBarTray> <ToolBar> <Button> <Canvas Width="16" Height="16" SnapsToDevicePixels="True"> <Polygon Stroke="Black" StrokeThickness="0.5" Points="2.5,1.5 9.5,1.5 12.5,4.5 12.5,15 2.5,15"> <Polygon.Fill> <LinearGradientBrush StartPoint="1,1" EndPoint="0.2,0.7"> <GradientStop Offset="0" Color="#AAA" /> <GradientStop Offset="1" Color="White" /> </LinearGradientBrush> </Polygon.Fill> </Polygon> <Polygon Stroke="Black" Fill="DarkGray" StrokeThickness="0.5" StrokeLineJoin="Bevel" Points="9.5,1.5 9.5,4.5 12.5,4.5" /> </Canvas> </Button> <Button> <Canvas Width="16" Height="16" > <Polygon Stroke="Black" StrokeThickness="0.5" Fill="Khaki" SnapsToDevicePixels="True" Points="0.5,14.5 0.5,4.5 1.5,3.5 6.5,3.5 8.5,5.5 12.5,5.5 12.5,14.5" /> <Polygon Stroke="Black" SnapsToDevicePixels="True" ...