RadWindow.Alert does not have keyboard focus when shown

7 posts, 1 answers
  1. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 26 Oct 2011 Link to this post

    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.
  2. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 26 Oct 2011 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 26 Oct 2011 Link to this post

    Sad to say that, no, the latest internals do not fix the issue.
  5. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 31 Oct 2011 Link to this post

    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 >>
  6. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 31 Oct 2011 Link to this post

    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.
  7. Ken
    Ken avatar
    3 posts
    Member since:
    Dec 2011

    Posted 09 Feb 2012 Link to this post

    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>
      
      
    ...
  8. Adam
    Adam avatar
    38 posts
    Member since:
    Oct 2010

    Posted 09 Feb 2012 Link to this post

    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 ;)
Back to Top
UI for WPF is Visual Studio 2017 Ready