in XamlControlsGallery/ControlPages/CommandBarPage.xaml.cs [65:122]
private void AddSecondaryCommands_Click(object sender, RoutedEventArgs e)
{
// Add compact button to the command bar. It provides functionality specific
// to this page, and is removed when leaving the page.
if (PrimaryCommandBar.SecondaryCommands.Count == 1)
{
var newButton = new AppBarButton
{
Icon = new SymbolIcon(Symbol.Add),
Label = "Button 1"
};
newButton.KeyboardAccelerators.Add(new Windows.UI.Xaml.Input.KeyboardAccelerator()
{
Key = Windows.System.VirtualKey.N,
Modifiers = Windows.System.VirtualKeyModifiers.Control
});
PrimaryCommandBar.SecondaryCommands.Add(newButton);
newButton = new AppBarButton
{
Icon = new SymbolIcon(Symbol.Delete),
Label = "Button 2"
};
PrimaryCommandBar.SecondaryCommands.Add(newButton);
newButton.KeyboardAccelerators.Add(new Windows.UI.Xaml.Input.KeyboardAccelerator()
{
Key = Windows.System.VirtualKey.Delete
});
PrimaryCommandBar.SecondaryCommands.Add(new AppBarSeparator());
newButton = new AppBarButton
{
Icon = new SymbolIcon(Symbol.FontDecrease),
Label = "Button 3"
};
newButton.KeyboardAccelerators.Add(new Windows.UI.Xaml.Input.KeyboardAccelerator()
{
Key = Windows.System.VirtualKey.Subtract,
Modifiers = Windows.System.VirtualKeyModifiers.Control
});
PrimaryCommandBar.SecondaryCommands.Add(newButton);
newButton = new AppBarButton
{
Icon = new SymbolIcon(Symbol.FontIncrease),
Label = "Button 4"
};
newButton.KeyboardAccelerators.Add(new Windows.UI.Xaml.Input.KeyboardAccelerator()
{
Key = Windows.System.VirtualKey.Add,
Modifiers = Windows.System.VirtualKeyModifiers.Control
});
PrimaryCommandBar.SecondaryCommands.Add(newButton);
}
MultipleButtons = true;
}