Indicating default button in a dialog with text input

1 Answer 202 Views
Buttons RichTextBox
Toby
Top achievements
Rank 1
Toby asked on 26 Aug 2022, 03:52 PM

Hello,

Is it possible to highlight the default button on a text input dialog? As per: 

Focus is on the text input and I can type, but Save is highlighted and clearly the default when hitting enter. Note that when you tab through to Cancel, Save is no longer highlighted and cancel is - this is the behaviour I would like to implement.

Is there a way of building a dialog with input text and highlighting the default button? For a normal dialog with a message and no text input, setting the button as the FocusedElement suffices, but that will not work for the case with an input.

Cheers

1 Answer, 1 is accepted

Sort by
0
Accepted
Stenly
Telerik team
answered on 31 Aug 2022, 03:25 PM

Hello Toby,

Since it is suggested that only one control should have the focus, what comes to my mind would be to achieve this highlighting via a style, together with the IsDefault property of the RadButton element. I have prepared a sample project, which allows you to keep the focus on a TextBox element and move the custom highlight style to a different button when the Tab key is pressed.

The result from the sample project is as follows:

I hope the provided application will be of help to you.

Regards,
Stenly
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Toby
Top achievements
Rank 1
commented on 05 Sep 2022, 02:28 PM

Thank you Stenly
Tags
Buttons RichTextBox
Asked by
Toby
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or