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

RadWindow.Alert does not have keyboard focus when shown

6 Answers 195 Views
Window
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 26 Oct 2011, 05:50 PM
I am using RadWindows in place of MessageBoxes in my application.  However, the RadWindow.Alert windows activated when they are shown.  In other words when they are shown I assume that I can press the Enter key and close them but this is not the case.  However if I click on the window and then press the Enter key the window is closed.

The RadWindow.Prompt does not seem to have this same issue however I am not setting any property specially on either.

I have tried using the Opened property to set focus on the RadWindow and the RadAlert but that shows an undesirable adorner around the element.  I would be fine with doing this on the button however it does not seem to appear in the visual tree.  There also appears to be no Activate method for the RadWindow nor is there a ShowActivated property.  I'm out of options at this point.  Is this a defect that should be logged?  Please advise.

6 Answers, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 26 Oct 2011, 05:53 PM
I should mention that I am still running the 9/12 internal build but there do not seem to be any fixes in the release notes that apply to this.  I will try the latest even so.
0
Adam
Top achievements
Rank 1
answered on 26 Oct 2011, 05:58 PM
Sad to say that, no, the latest internals do not fix the issue.
0
Accepted
Konstantina
Telerik team
answered on 31 Oct 2011, 05:36 PM
Hi Adam,

Currently the behavior is that pressing Escape will trigger the Cancel button and Pressing Enter will trigger the OK button. And the focus is not on neither of the buttons. The only way to workaround this at the moment is to create a new RadWindow as a UserControl with the Ok and Cancel buttons and to set in code the focus to one of the buttons and then use this custom window as Alert. However we will consider changing this behavior as you are right that at the moment it is not very user friendly. There is a Pits item already created where you can vote for this feature and follow its progress. It is for RadConfirm, but it goes for all predefined dialogs.

Hope this information is helpful.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Adam
Top achievements
Rank 1
answered on 31 Oct 2011, 06:49 PM
Okay, I've tested everything out and actually on none of the predefined dialogs can I just bring it up and press the Enter or Cancel key to close the window.  The problem is that the windows are not activated when they are displayed.  The only one that appears to function correctly is the Prompt dialog because the user must click in the prompt textbox to enter an answer before expecting to be able to click Enter or Cancel to exit the window.

I've voted on the PITS issue but honestly think the solution or name of the issue is not really what will fix this.  System.Windows.Window and anything derived thereof has a ShowActivated property which should be implemented here and should be true by default.  If I show the user a RadWindow.Alert they should not have to first click the window and then the Enter key.

Thanks for the alternate solution, I'll look into this.
0
Ken
Top achievements
Rank 1
answered on 09 Feb 2012, 05:44 PM
Here's how I solved the problem.

Using Blend I grabbed the style for the RadAlert and then used the FocusManager.FocusedElement attached property
on LayoutRoot to be the OK button.

....
  
                <ControlTemplate TargetType="{x:Type telerik:RadAlert}">
                    <Grid x:Name="LayoutRoot" FocusManager.FocusedElement="{Binding ElementName=OK}">
  
...
  
                        <telerik:RadButton x:Name="OK" Grid.ColumnSpan="2" Content="OK" Command="telerik:WindowCommands.Confirm" HorizontalAlignment="Right" IsTabStop="True" InnerCornerRadius="0" Margin="0,10,8,8" MinWidth="70" Grid.Row="2" telerik:LocalizationManager.ResourceKey="Ok" telerik:RadWindow.ResponseButton="Accept" TabIndex="0">
                            <telerik:StyleManager.Theme>
                                <telerik:Office_BlackTheme/>
                            </telerik:StyleManager.Theme>
                        </telerik:RadButton>
  
  
...
0
Adam
Top achievements
Rank 1
answered on 09 Feb 2012, 07:19 PM
Thanks Ken but the PITS issue went through and focus is now given when the dialogs are shown the way I wanted.  I think this was for Q3 or a little before, I can't remember.  Can't believe I didn't think of that though it's a good solution; admittedly i'm still a little green ;)
Tags
Window
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Konstantina
Telerik team
Ken
Top achievements
Rank 1
Share this question
or