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

GridView and ESC key

4 Answers 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Miloš Sommer
Top achievements
Rank 1
Miloš Sommer asked on 13 Jan 2011, 09:48 AM
Hello,

I would like to ask why GridView is handling ESC key in ReadOnly mode. I have it used in RadWindow and RadButton with telerik:RadWindow.ResponseButton="Cancel"  set.

Problem is that ESC key is handled by GridView and never processed by RadWindow.

my structure of xaml:

<telerik:RadWindow x:Name="SampleDetail" Header="{Binding Strings.SampleDetail,
        Source={StaticResource Resources}}"  WindowStartupLocation="CenterOwner" Padding="10" >
 
        <telerik:RadGridView x:Name="gridRequests" Style="{StaticResource GridStyle}"  ItemsSource="
                {Binding Requests.RequestsGridSource}"  HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch" IsFilteringAllowed="False" AutoGenerateColumns="False" Height="450" 
                IsReadOnly="True" SelectionMode="Single">
 
                ... columns
 
        </telerik:RadGridView>
 
        <telerik:RadButton x:Name="buDetailClose" Click="buDetailClose_Click"
                Content="{Binding Strings.Close, Source={StaticResource Resources}}" Margin="5"
                telerik:RadWindow.ResponseButton="Cancel" />
</telerik:RadWindow>


I have found found workaround with CustomKeyboardCommandProvider but I think it is not usuall grid behavior.

public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
        {
            List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
             if (key == Key.Escape)
            {
                commandsToExecute.Remove(RadGridViewCommands.CancelCellEdit);
            }
return commandsToExecute;
 
}


Should I set my CustomKeyboardCommandProvider in every grid in every RadWindow?

Thank you for your response
misa

4 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 13 Jan 2011, 10:18 AM
Hello Michaela Košutová,

You are quite correct - the Esc key is handled even if the IsReadOnly property of the grid is set to "True". We will investigate the issue and change the behavior in one of our next releases - most probably in some of our Latest Internal Builds.
For the time being the workaround would be the one you have already found out - using CustomKeyboardCommandProvider.
 

Kind regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Miloš Sommer
Top achievements
Rank 1
answered on 13 Jan 2011, 10:39 AM
Thank you for your answer.
0
Riia
Top achievements
Rank 1
answered on 18 Apr 2011, 12:26 PM
Hi,

We have the latest Telerik version and use similar combination with RadWindow, GridView and buttons. When focus is in grid, it seems that RadWindow can be closed ok with Esc (Cancel).

However, we would like it to behave also so that pressing Enter would perform the default action (OK button). In other words when focus is in grid, pressing Enter would select the currently selected row and close the RadWindow. The default functionality for Enter in grid seems to be that the focus is moved to the next row?

Do you have any recommendations how to implement that?

Best regards,
Riia
0
Maya
Telerik team
answered on 19 Apr 2011, 01:40 PM
Hi Riia,

You may take a look at this blog post for a reference and implement something similar in our particular case. Most probably the way the Enter key is handled in the CustomKeyboardCommandProvider class will be helpful in your scenario as well. Still, if not, please share a bit more details about the exact settings and functionality of your grid and window.

 

Best wishes,
Maya
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
Tags
GridView
Asked by
Miloš Sommer
Top achievements
Rank 1
Answers by
Maya
Telerik team
Miloš Sommer
Top achievements
Rank 1
Riia
Top achievements
Rank 1
Share this question
or