Is there a way to assign shortcut keys to the standard navigation ToolStrip Items in a BindingNavigator?
The items that get added using the .AddStandardItems method are of type ToolStripItem which doesn't have a ShortcutKeys property.
I tried to cast to ToolStripMenuItem , but it fails.
public void ConfigureMyNavigator()
{
// Adds ToolStripItems which don't support shortcut keys
m_navigator.AddStandardItems();
// Adds a ToolStripMenuItem which can support a shortcut key
var button = new ToolStripMenuItem
{
Size = new Size(0, 0),
Text = "Save",
ShortcutKeys = (Keys)Shortcut.CtrlS,
ToolTipText = "Press Ctrl+S to save"
};
button.Click += tsmi_Click;
m_navigator.Items.Add(button);
// This fails with invalid cast exception
((ToolStripMenuItem)m_navigator.Items[1]).ShortcutKeys = (Keys)Shortcut.AltLeftArrow;
}
I guess I could replace the toolstripitems with toolstripmenuitems one by one, but feel this is rather awkward.