RadMenuItem HotKey Not Firing Command

3 posts, 0 answers
  1. Barry
    Barry avatar
    3 posts
    Member since:
    Jan 2017

    Posted 03 Nov 2017 Link to this post

    The snippet below is from an application for a machine shop which has a rather utilitarian menu.... I've been asked to add hot keys to some of the items; one of the menu items (as seen in the code below) I need to add the F6 key as a hotkey (note the idendical Command for clicking vs hotkey)...   clicking on it works as desired, but the hotkey has seemingly no effect whatsoever.


    What am I missing, or otherwise doing wrong? Thanks in advance for your help.


            <telerik:RadMenuItem Name="ToolsMenu" Header="Tools">
                <telerik:RadMenuItem Name="ToolsUseFinishLocationMenuItem" Header="Use Finish Location For Bin" Command="{Binding ToolsUseFinishLocationForBinCommand}" InputGestureText="F6">
                        <KeyBinding Key="F6" Command="{Binding ToolsUseFinishLocationForBinCommand}" />

  2. Dilyan Traykov
    Dilyan Traykov avatar
    1013 posts

    Posted 08 Nov 2017 Link to this post

    Hello Barry,

    The reason for this issue has been described in the following thread. Using the InputBindingBehavior suggested there, you can define your RadMenu like so:

    <telerik:RadMenu local:InputBindingBehavior.PropagateInputBindingsToWindow="True">
            <KeyBinding Key="F6" Command="{Binding ToolsUseFinishLocationForBinCommand}" />
        <telerik:RadMenuItem Name="ToolsMenu" Header="Tools" >
            <telerik:RadMenuItem Name="ToolsUseFinishLocationMenuItem" Header="Use Finish Location For Bin" Command="{Binding ToolsUseFinishLocationForBinCommand}" InputGestureText="F6" />

    Please let me know if this works for you.

    Dilyan Traykov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Tayyaba
    Tayyaba avatar
    42 posts
    Member since:
    Apr 2017

    Posted 07 Feb 2018 Link to this post


    I'm also trying to use inputBindigns on my RadContextMenu items but they aren't working as i'm setting them in style as shows in code below:

    <Style x:Key="MenuItemContainerCustom" TargetType="telerik:RadMenuItem">
        <Setter Property="Header" Value="{Binding Text}"/>
        <Setter Property="telerik:InputBindingsManager.InputBindings">
                    <KeyBinding Key="{Binding DataContext.Key}" Modifiers="{Binding DataContext.Modifier}" Command="{Binding DataContext.Command}" />
        <Setter Property="HeaderTemplate">
                    <Grid Margin="-27,0,-30,0" >
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="1*" />
                        <StackPanel  Grid.Column="0"  Orientation="Horizontal" Margin="0 0 5 0">
                            <CheckBox  IsChecked="{Binding Path=DataContext.IsChecked, Mode=OneWay ,  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadMenuItem}}}"  Command="{Binding Path=DataContext.Command, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadMenuItem}}}"  Visibility="{Binding Path=DataContext.IsCheckboxEnabled, Mode=TwoWay,  RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadMenuItem}},Converter={StaticResource CheckBoxVisibilityConverter}}">
                        <StackPanel  Grid.Column="1" Orientation="Horizontal" Margin="0">
                            <TextBlock Text="{Binding}"/>
        <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
        <Setter Property="Command" Value="{Binding Command}"/>
        <Setter Property="IsEnabled" Value="{Binding IsMenuItemEnabled}"/>
    <Style x:Key="ContextMenuStyle" TargetType="{x:Type telerik:RadTreeViewItem}" BasedOn="{StaticResource SelectionStyle}">
        <Setter Property="telerik:RadContextMenu.ContextMenu">
                <telerik:RadContextMenu Width="{Binding ContextMenu.Width}"
                                            InheritDataContext="False" IsOpen="{Binding ContextMenu.IsOpened, Mode=TwoWay}"
                                            DataContext="{Binding UIElement.ParentTreeView.DataContext, RelativeSource={RelativeSource Self}}"
                                            ItemsSource="{Binding ContextMenu.MenuItems}"
                        ItemContainerStyle="{StaticResource MenuItemContainerCustom}">
                        <telerik:EventBinding EventName="Opening" Command="{Binding ContextMenuOpeningCommand}" CommandParameter="{Binding Path=UIElement.Item, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=telerik:RadContextMenu}}" />

    Let me know what am i doing wrong in the style block for setting inputBindings?

    Thank you in advance



Back to Top