RadWindow.Confirm keydown/press

5 posts, 2 answers
  1. Fred
    Fred avatar
    7 posts
    Member since:
    Jan 2015

    Posted 14 Jan 2015 Link to this post

    Hi everyone!

    I need to enable the user to choose between Yes or No in the RadWindow.Confirm by using the keyboard letters (to be more specific, the "S" letter to confirm and the "N" letter to cancel. This would replace the need to click the yes/no button, allowing the user to make the decision a bit faster. The buttons would still be there but the keyboard letters would be provided as shortcuts.

    Is there any way I can achieve that behavior by using the RadWindow.Confirm component?

    Thanks in advance,

    Fred
  2. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 16 Jan 2015 Link to this post

    Hello Fred,

    You can achieve the desired by using KeyBindings. You will need to extract the default Style and ControlTemplate of RadConfirm as explained in this article from our help documentation. Define the needed KeyBindings in the ControlTemplate as shown below:

    <Grid x:Name="LayoutRoot">
        <Grid.InputBindings>
            <KeyBinding Key="S" Command="{x:Static telerik:WindowCommands.Confirm}" />
            <KeyBinding Key="N" Command="{x:Static telerik:WindowCommands.Cancel}"/>
        </Grid.InputBindings>
    ...
    </Grid>

    And set the modified Style as ContentStyle of the dialog.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Fred
    Fred avatar
    7 posts
    Member since:
    Jan 2015

    Posted 04 Feb 2015 in reply to Kalin Link to this post

    Hello Kalin,

    Thanks for the answer, it worked like a charm!

    By the way, is there a way to format the confirm button text in a way that the first letter is underlined? For example, in the "Sim" button, can I have the "S" underlined and the rest of the text unchanged?

    Thank you!

    Regards,
    Fred
  5. Answer
    Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 05 Feb 2015 Link to this post

    Hi Fred,

    You can try the approach demonstrated here. Note that you would need to also remove the following property from the Button in the Template:

    telerik:LocalizationManager.ResourceKey="Ok"

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Fred
    Fred avatar
    7 posts
    Member since:
    Jan 2015

    Posted 05 Feb 2015 in reply to Kalin Link to this post

    It worked perfectly, thank you!
Back to Top
UI for WPF is Visual Studio 2017 Ready