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

Override TextChanged event for RadTextBox

2 Answers 371 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
hans
Top achievements
Rank 1
hans asked on 03 Feb 2015, 02:08 PM
I would like to override the TextChanged event of my own inherited textbox.  How should I proceed?
For the Click event of an inherited button I do have the following working code, but for a textbox I cannot find the right way.

using System;
using System.Windows.Forms;
using Telerik.WinControls.UI;

namespace Iap.WinUi.Controls.Button
{
public class QButton : RadButton
{
protected override RadButtonElement CreateButtonElement()
{
return new QButtonElement(this);
}
}

public class QButtonElement : RadButtonElement
{
private readonly RadButton Owner;

public QButtonElement(RadButton owner)
{
Owner = owner;
}

protected override void OnClick(EventArgs e)
{
var form = Owner.FindForm();
try
{
// set wait cursor
form.Cursor = Cursors.WaitCursor;
form.Refresh();

// execute base click code
base.OnClick(e);
}
finally
{
// set arrow cursor
form.Cursor = Cursors.Default;
}
}

protected override Type ThemeEffectiveType
{
get { return typeof (RadButtonElement); }
}
}
}

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 Feb 2015, 02:21 PM
Hello Hans,

Thank you for writing.

You can override the method directly in the textbox class:
class MyTextBox : RadTextBox
{
    protected override void OnTextChanged(EventArgs e)
    {
        base.OnTextChanged(e);
    }
}

Please let me know if there is something else I can help you with. 
 
Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
hans
Top achievements
Rank 1
answered on 06 Feb 2015, 07:59 AM
Thanks

Works just fine
Tags
TextBox
Asked by
hans
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
hans
Top achievements
Rank 1
Share this question
or