Can WindowCommands.Close and ResponseButton="Cancel" work together?

3 posts, 1 answers
  1. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 05 Mar 2013 Link to this post

    Esc doesn't close the window, why? 

    <telerik:RadButton Content="Cancel" Command="telerik:WindowCommands.Close" telerik:RadWindow.ResponseButton="Cancel" Width="70"/>
  2. Answer
    Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 08 Mar 2013 Link to this post

    Hi Martin,

    By default the close button of the RadWindow is not designed to close the Window when the Escape button is pressed.

    All you need to do to enable this functionality is to set the InputBindings of the control for the Escape key, the next code snippet shows the described approach:
    <telerik:RadWindow.InputBindings>
        <KeyBinding Key="Escape"
                Command="{x:Static telerik:WindowCommands.Close}"/>
    </telerik:RadWindow.InputBindings>


    Greetings,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 08 Mar 2013 Link to this post

    Thanks
Back to Top