This is a migrated thread and some comments may be shown as answers.

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

2 Answers 182 Views
Window
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 2
Martin asked on 05 Mar 2013, 11:41 AM
Esc doesn't close the window, why? 

<telerik:RadButton Content="Cancel" Command="telerik:WindowCommands.Close" telerik:RadWindow.ResponseButton="Cancel" Width="70"/>

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 08 Mar 2013, 09:50 AM
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.

Allen
Top achievements
Rank 2
Iron
Veteran
commented on 09 Feb 2023, 02:29 PM

Where should this code be put in for a standard aspx form page that is (maybe) a RadWindow but not declared as such?

And how does one ensure that if the form is dirty that a prompt appears?

 

<html lang="en-us">
<%-- xmlns="http://www.w3.org/1999/xhtml"> --%>
<head id="head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        <%= GetUserTitle() %>
    </title>
    <%-- ARMarshall, ARM LLC 20150827 - put this img link here to force favicon.ico to appear properly--%>
    <%-- <link href="/Images/favicon.ico" --%>
</head>
<body id="body1" class="flex-body bg-cornsilk w-auto" >
    <header class="page-header flex-row h-0 invisible border-none"></header>

    <form id="form1" runat="server" class="page-content flex-form  w-full h-full bg-cornsilk" defaultbutton="RadButtonClose" defaultfocus="RadButtonClose">
...
...
....
</form>
 <footer class="page-footer h-0 border-none invisible"></footer>
</body>
</html>


Martin Ivanov
Telerik team
commented on 10 Feb 2023, 04:49 PM

Hi Allen. This is the UI for WPF forum. Can you please post your question in the ASP.NET forums?
0
Martin
Top achievements
Rank 2
answered on 08 Mar 2013, 10:35 AM
Thanks
Tags
Window
Asked by
Martin
Top achievements
Rank 2
Answers by
Vladi
Telerik team
Martin
Top achievements
Rank 2
Share this question
or