Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
This example shows how to create ToolBar controls in Extensible Application Markup Language (XAML) and C#. The examples illustrate ToolBar controls that are contained in ToolBarTray controls and are positioned in the tray using the Band and BandIndex properties.
Example
<ToolBarTray Background="White">
<ToolBar Band="1" BandIndex="1">
<Button><Image Source="toolbargraphics\new.bmp" /></Button>
<Button><Image Source="toolbargraphics\open.bmp" /></Button>
<Button><Image Source="toolbargraphics\save.bmp" /></Button>
<Separator/>
<Button><Image Source="toolbargraphics\cut.bmp" /></Button>
<Button><Image Source="toolbargraphics\copy.bmp" /></Button>
<Button><Image Source="toolbargraphics\paste.bmp" /></Button>
<Separator/>
<Button><Image Source="toolbargraphics\print.bmp" /></Button>
<Button><Image Source="toolbargraphics\preview.bmp" /></Button>
</ToolBar>
</ToolBarTray>
For the complete sample see Toolbar Sample.
tbartray = new ToolBarTray();
tbar = new ToolBar();
btn = new Button();
btn.Content = "File";
tbar.Items.Add(btn);
btn1 = new Button();
btn1.Content = "Edit";
tbar.Items.Add(btn1);
tbar1 = new ToolBar();
btn2 = new Button();
btn2.Content = "Format";
tbar1.Items.Add(btn2);
btn3 = new Button();
btn3.Content = "View";
tbar1.Items.Add(btn3);
btn4 = new Button();
btn4.Content = "Help";
tbar1.Items.Add(btn4);
tbartray.ToolBars.Add(tbar);
tbartray.ToolBars.Add(tbar1);
spanel2.Children.Add(tbartray);
For the complete sample see Creating Controls Sample.
See Also
Tasks
How to: Use Triggers to Style a ToolBar