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

Initial text selected

5 Answers 42 Views
InputPrompt
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Florent
Top achievements
Rank 1
Florent asked on 20 Sep 2013, 04:54 PM
Hello,

I created an InputPrompt and choosed an initial text  by using Style / InputPrompSettings class and settings the RadTextBox.TextProperty

But, there is 2 issues. The cursor stay at the begin of the RadTextBox and the initial text is not selected so I can change it only by pressing one letter on keyboard.

Is there a way to achieve it ?

Thanks for your answer.

Regards,
Florent

5 Answers, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 23 Sep 2013, 05:38 PM
Hi Florent,

If you are trying to clear out the text in the InputPrompt when the user clicks on it, you should write an event handler for the GotFocus event.

The markup would define a name and an event handler:

<Controls:RadTextBox Name="telerikInput" Text="enter text here..." GotFocus="inputGotFocus" />

And the event in the code behind will clear the text in the InputPrompt:

private void inputGotFocus(object sender, RoutedEventArgs e)
{
    telerikInput.Text = "";
}


Good luck,
Master Chief
0
Todor
Telerik team
answered on 24 Sep 2013, 07:58 AM
Hello Florent,

I'm not sure I understand correctly your desired behavior, but it sound like it would be best if you set the Watermark property through Style. This way, when you start typing the initial value will be cleared. If you want to keep using the Text Property, you will not be able to move the cursor's position, but the text can again be easily cleared, this time with the Clear Button that is part of the text box.

I hope this information helps.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Florent
Top achievements
Rank 1
answered on 24 Sep 2013, 08:57 AM
No, my need is to select the initial text so I can choose to override it only by typing one letter. Same behaviour as when you create a new folder on Windows, where you can choose to rename it instead of keeping the name "New folder".

Sure, users can still use the erase button and start to type, but it is just common ergonomy to allow it in a more usual and quickest way.
0
Todor
Telerik team
answered on 25 Sep 2013, 06:23 AM
Hi Florent,

Thank you for getting back to us.

The initial selection is not possible in RadInputPrompt. It visualizes an instance of RadTextBox, which inherits from the native TextBox control. The selection is provided by the native control by the properties SelectedText, SelectionStart, SelectionLength. However, since none of them is a dependency property they can't be set through style.
 
Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Todor
Telerik team
answered on 13 Dec 2013, 09:04 AM
Hello Florent,

I just wanted to let you know about a possible workaround for your scenario in case you still need to add initial selection in RadInputPrompt. You can find the sample project as an attachment to this post.

Let us know if you need further assistance.

Regards,
Todor
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
InputPrompt
Asked by
Florent
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Todor
Telerik team
Florent
Top achievements
Rank 1
Share this question
or