MouseDown event invalid

1 Answer 48 Views
Form TextBox
chaoyuan
Top achievements
Rank 1
chaoyuan asked on 09 Dec 2023, 02:58 AM

Mouse Down event invalid.

private void radTextBox1_MouseDown(object sender, MouseEventArgs e)
{
    radTextBox1.Text = "test";
}

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 11 Dec 2023, 09:08 AM

Hi chaoyuan,

Thank you for the provided code snippet.

I am assuming that the event is not called. Am I right? If yes, note that RadTextBox internally hosts the standard MS TextBox. You will need to subscribe to its MouseDown event to catch the moment when the user clicks on the cursor position.

this.radTextBox1.TextBoxElement.TextBoxItem.HostedControl.MouseDown += TextBoxItem_MouseDown;

private void TextBoxItem_MouseDown(object? sender, MouseEventArgs e)
{
 // custom logic   
}

Give this a try and let me know if it works for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Form TextBox
Asked by
chaoyuan
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or