RadTextBox Null Text Style

2 posts, 0 answers
  1. Paul
    Paul avatar
    35 posts
    Member since:
    Jan 2014

    Posted 06 Jul 2014 Link to this post

    Is it at all possible to change the style of the RadTextBox when there is no text value - i.e Null Text?

    I am used to the Infragistics controls and there is a nice and easy appearance for this.

    Thanks

    Andez
  2. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 09 Jul 2014 Link to this post

    Hello Andez,

    Thank you for writing.

    Yes you can style the null text. For example you can change its color as follows:
    radTextBox1.TextBoxElement.TextBoxItem.NullTextColor = Color.Red;

    Additionally you can use the GotFocus and LostFocus events to change other styles:
    void radTextBox1_GotFocus(object sender, EventArgs e)
    {
        if (radTextBox1.Text == null || radTextBox1.Text == string.Empty)
        {
            this.radTextBox1.TextBoxElement.BackColor = Color.White;
        }
    }
     
    void radTextBox1_LostFocus(object sender, EventArgs e)
    {
        if (radTextBox1.Text == null || radTextBox1.Text == string.Empty)
        {
            this.radTextBox1.TextBoxElement.BackColor = Color.LightGray;
        }
    }

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top