We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Highlight all text of a RibbonTextBox when it has focus

How can I highlight all the text of a RibbonTextBox control when it gets focus?


Thank you

5 Replies

BK Bharadhi K Syncfusion Team April 22, 2015 06:31 AM UTC

Hi Constantin Patak,

Thank you for your interest in Syncfusion products.

We can highlight all the Text of the RibbonTextBox control by invoking the "SelectAll" method. We have prepared a sample to demonstrate the same. In the sample, we have added three RibbonTextBox to the RibbonBar and for the second RibbonTextBox we have invoked the SelectAll method in the GotFocus event. Please find the sample in the following link.

Sample: RibbonSample.zip

Could you please let us know if our solution fulfills your requirements and if you require further assistance on this.

Regards,
Bharadhi K


CP Constantin Patak April 22, 2015 12:32 PM UTC

Hello Bharadhi,

Thank you for your quick reply.

I have seen the sample and I am experience the following issues:
  1. When I click the second RibbonTextBox (the one with the GotFocus event) it selects all the text and instantly deselects it
  2. And in the following scenario: click in the second RibbonTextBox -> click in the text under the Ribbon -> click again in the second RibbonTextBox, the GotFocus event does not trigger again.

Is there a way to deal with these two problems.


Thank you



BK Bharadhi K Syncfusion Team April 23, 2015 05:37 AM UTC

Hi Constantin Patak,

Query 1: When I click the second RibbonTextBox (the one with the GotFocus event) it selects all the text and instantly deselects it

In our earlier sample we had given for Keyboard Focus. Now we have modified the sample for both Mouse and Keyboard focus. In the sample, we have handled the PreviewMouseLeftButtonDown event and set Focus to the RibbonTextBox. Also we have used GotKeyboardFocus event in place of GotFocus for setting focus theough Keyboard.

Query 2: And in the following scenario: click in the second RibbonTextBox -> click in the text under the Ribbon -> click again in the second RibbonTextBox, the GotFocus event does not trigger again.

We have checked this with MS TextBox and it has the same behavior. We have modified the sample as mentioned above, to provide focus on mouse events separately.

Please find the modified sample in the following link.

Sample: Ribbon_131602.zip

Please let us know if our solution fulfills your requirements and if you require further assistance on this.

Regards,
Bharadhi K


CP Constantin Patak April 23, 2015 01:12 PM UTC

Hi Bharadhi,

The sample works perfectly.

Thanks a lot for your help.


SC Saranya CJ Syncfusion Team April 24, 2015 06:52 AM UTC

Hi Constantin,

Thank you for your update. Please let us know if you require any other assistance on this.

Regards,
Saranya

Loader.
Live Chat Icon For mobile
Up arrow icon