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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Highlight all text of a RibbonTextBox when it has focus

Thread ID:

Created:

Updated:

Platform:

Replies:

118902 Apr 21,2015 07:58 PM UTC Apr 24,2015 06:52 AM UTC WPF 5
loading
Tags: Ribbon
Constantin Patak
Asked On April 21, 2015 07:58 PM UTC

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


Thank you

Bharadhi K [Syncfusion]
Replied On 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

Constantin Patak
Replied On 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


Bharadhi K [Syncfusion]
Replied On 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

Constantin Patak
Replied On April 23, 2015 01:12 PM UTC

Hi Bharadhi,

The sample works perfectly.

Thanks a lot for your help.

Saranya CJ [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;