RadButton AccessText Hotkey

5 posts, 0 answers
  1. Daniel Schuessler
    Daniel Schuessler avatar
    7 posts
    Member since:
    Mar 2010

    Posted 20 Apr 2010 Link to this post

    How would you implement a hotkey for the Approve RadButton in the following code snippet?

              <telerik:RadButton Name="btApproveReport"  Click="btApproveReport_Click"  Margin="10,0,10,0" Width="Auto" HorizontalContentAlignment="Center" MaxHeight="30" VerticalContentAlignment="Center" > 
                <telerik:RadButton.Content> 
                  <StackPanel Orientation="Horizontal" Margin="4 0"
                    <TextBlock Text="Approve"   Foreground="DarkGreen" FontSize="12" /> 
                    <Image Source="pack://application:,,,/Resources/CheckMark.png" Margin="5 0 0 0" Height="16" Width="16" /> 
                  </StackPanel> 
                </telerik:RadButton.Content> 
              </telerik:RadButton> 

  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 23 Apr 2010 Link to this post

    Hi Daniel Schuessler,

    The best approach for handing hotkeys is using Commands like follows.

    <Window.InputBindings>
            <KeyBinding Modifiers="Control" Key="a" Command="ApplicationCommands.Open"/>
        </Window.InputBindings>
        <Window.CommandBindings>
            <CommandBinding Command="ApplicationCommands.Open" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
        </Window.CommandBindings>
        <Grid>
            <telerik:RadButton Name="btApproveReport" Command="ApplicationCommands.Open"  Margin="10,0,10,0" Width="Auto" HorizontalContentAlignment="Center" MaxHeight="30" VerticalContentAlignment="Center" >
                <telerik:RadButton.Content>
                    <StackPanel Orientation="Horizontal" Margin="4 0">
                        <TextBlock Text="Approve"   Foreground="DarkGreen" FontSize="12" />
                        <!--<Image Source="pack://application:,,,/Resources/CheckMark.png" Margin="5 0 0 0" Height="16" Width="16" />-->
                    </StackPanel>
                </telerik:RadButton.Content>
            </telerik:RadButton>
        </Grid>


    And in the code behind:

    private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
    {
        //Your click handler.
    }
     
    private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
    {
        e.CanExecute = true;
    }

    Hope will works for you.

    All the best,
    Miro Miroslavov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Subha
    Subha avatar
    2 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2011 Link to this post

    Is there similar procedure for Silverlight?  We are looking to add some hot keys for button click events.
    Thanks,
    Subha
  5. Subha
    Subha avatar
    2 posts
    Member since:
    Sep 2010

    Posted 08 Dec 2011 Link to this post

    Is there similar procedure for Silverlight?  We are looking to add some hot keys for button click events.
    Thanks,
    Subha
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 13 Dec 2011 Link to this post

    Hi Subha,

     Please check out the attached project which follows the approach described in this help article and let us know if it satisfies you.

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
UI for WPF is Visual Studio 2017 Ready