InputGestureText in Ribbon menu item

Ribbon for WPF Forum

Posted 15 years ago by Eli Gazit - CEO, Softwear Suit Ltd
Version: 4.5.0487
Avatar
Hi,

I have a drop down button which in it I created Buttons.
I want to assign shortcuts to those buttons (Alt+1, Alt+2 etc...)
I had thi feature supported on Infragistics Ribbon.

Is it possible on Actipro one as well?

In Normal WPF it is refered as myButton.InputGestureText = "Alt+1";

Doesn't work for Actipro.

Comments (6)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe we support it. Can you post some simple XAML code we can try out to see the issue? Thanks!


Actipro Software Support

Posted 15 years ago by Eli Gazit - CEO, Softwear Suit Ltd
Avatar
Here is the code:

RibbonControls.Menu ownerMnu= new RibbonControls.Menu();
Button button = new Button();
button.Name = sButtonName.Replace(' ' ,'_');
button.Label = sButtonLabel;
button.InputGestureText = graphRibbonDef.ShortCut;
ownerMnu.Items.Add(button);

ownerMnu is obviously hosted in a PopupButton


I also try editing your Editor example:
<ribbon:Button Command="sample:ApplicationCommands.FileNewRtfDocument" KeyTipAccessText="R" MenuItemDescription="Creates a new rich-text file for editing in the application." InputGestureText="Alt+1" />

Doesn't work as well.
Thanks,
Isaac

[Modified at 05/13/2009 12:23 AM]
Posted 15 years ago by Eli Gazit - CEO, Softwear Suit Ltd
Avatar
This works partially

private static RibbonCommand _exportToImage;
public static RibbonCommand ExportToImage
{
get
{
InputGestureCollection coll = new InputGestureCollection();
coll.Add(new KeyGesture(Key.M, ModifierKeys.Alt));
if (_exportToImage == null)
_exportToImage = new RibbonCommand("ExportToImage",
typeof(Ribbon), "Export to Image",
"/LogbiGUI;component/Resources/Images/exportToImage16.png",
"/LogbiGUI;component/Resources/Images/exportToImage16.png",null,
coll);
return _exportToImage;
}
}

If you hit Alt+M it will work but in the menu item the text is still
Export to Image
Rather than
Export to Image Alt+M

If needed I can provide a print screen if you give me an email to send it to.
Posted 15 years ago by Eli Gazit - CEO, Softwear Suit Ltd
Avatar
It is shown in the screen tip.
I guess for now it will be sufficient.
But I do recommend that if the Ribbon Button is in a Ribbon Menu it will be shown next to the menu item (Align to the Right).

I noticed it doesn't happen even in office but I think it might be nice.

Thanks for trying to help.
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Eli,

There is an inherited attached property called Menu.IsMenuItemInputGestureTextVisible that determines whether input gesture text shows up on menu items.

By default it is false meaning the shortcuts don't show up since in most scenarios in Ribbon, it's not supposed to (per Office). However context menus by default change this property to show shortcuts.

You can set that attached property to true on your menu if you wish to display shortcuts on your Menu items.


Actipro Software Support

Posted 15 years ago by Eli Gazit - CEO, Softwear Suit Ltd
Avatar
Awesome that works!!!!

[Modified at 05/14/2009 12:12 AM]
The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.