Override TextChanged event for RadTextBox

3 posts, 0 answers
  1. hans
    hans avatar
    6 posts
    Member since:
    Aug 2006

    Posted 03 Feb 2015 Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 05 Feb 2015 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. hans
    hans avatar
    6 posts
    Member since:
    Aug 2006

    Posted 06 Feb 2015 in reply to Dimitar Link to this post

    Thanks

    Works just fine
Back to Top