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

InputScope search does not accept the "enter" button

4 Answers 81 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 2
Andrew asked on 21 Sep 2012, 12:59 PM
The virtual keyboard shows a white arrow that you can normally press to indicate action. However it does nothing. I would expect it to call the ActionButtonCommand. Am I doing anything wrong?

<telerikPrimitives:RadTextBox Watermark="search" ActionButtonVisibility="Visible"
    ActionButtonCommand="{Binding DoSearchCommand}" InputScope="Search"  />

4 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 21 Sep 2012, 02:28 PM
Hello Robert,

Thank you for your question.

I assume that the arrow that you mean is the Enter key. Pressing it, however would not execute the ActionButtonCommand, because for some scenarios (for example multiple row text box) it might not be the desired behavior. You can easily implement this functionality by providing an event handler for the KeyDown or KeyUp events of RadTextBox and execute the associated command manually:
private void textBox_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Enter)
    {
        ICommand command = textBox.ActionButtonCommand as ICommand;
        command.Execute(textBox.Text);
    }
}

I hope this information helps. Let me know if I can assist you further.

Greetings,
Todor
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Andrew
Top achievements
Rank 2
answered on 21 Sep 2012, 02:50 PM
While your solution does work it requires so much more code and isn't elegant. For multi-row text box, isn't that what the AcceptsReturn property is for. I would think that you could read that property and if set to false you could handle the enter button correctly by calling the actionbuttoncommand.
0
Accepted
Todor
Telerik team
answered on 24 Sep 2012, 08:08 AM
Hi Robert,

Thank you for your suggestion.

We designed the ActionButton to be abstract enough so it might have a function which is not necessarily related to the Enter key. For example, in a "Add new contact" page, the enter key can be used for saving the new contact and the ActionButton in some of the fields might be for adding a photo. I agree that the scenario where you want the ActionButton to be executed when Enter key is pressed seems more common and this is why we decided to introduce a new property in RadTextBox that will allow you to choose whether you want to execute the ActionButtonCommand on Enter or not. The new property will be available with our next internal build.

Let me know if you have other suggestions or questions regarding our controls.

Greetings,
Todor
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Andrew
Top achievements
Rank 2
answered on 24 Sep 2012, 12:04 PM
That's a better solution than my suggestion actually. Thanks.

Robert
Tags
TextBox
Asked by
Andrew
Top achievements
Rank 2
Answers by
Todor
Telerik team
Andrew
Top achievements
Rank 2
Share this question
or