Custom RadGroupBox

1 Answer 45 Views
GroupBox
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Mark asked on 26 Feb 2024, 12:54 PM

I want to create a class of RadGroupBox that when I drop my class on a form, that there is no "TEXT" value.  We use the GroupBox alot in our system, /w out the HEADER TEXT.  So far, my attempts have failed.   Here is my GroupBy class.

 


   public sealed class NtsRadGroupBoxNoHeader : RadGroupBox
   {
      #region Public Constructors

      public NtsRadGroupBoxNoHeader()
      {
         Padding = new System.Windows.Forms.Padding(2);
         ThemeClassName = "Telerik.WinControls.UI.RadGroupBox";
         Text = string.Empty;
         AccessibleName = string.Empty;
         AccessibleDescription = string.Empty;
         ((Telerik.WinControls.Primitives.TextPrimitive)(GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Text = string.Empty;
      }

      #endregion Public Constructors
   }

1 Answer, 1 is accepted

Sort by
1
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 28 Feb 2024, 07:56 AM

Hello, Mark,

Thank you for the provided code snippet.

In order to use your custom RadGroupBox control without the header text, you should override the Text property to return empty string the following way:

public sealed class NtsRadGroupBoxNoHeader : RadGroupBox
{
    public NtsRadGroupBoxNoHeader()
    {
        ThemeClassName = "Telerik.WinControls.UI.RadGroupBox";
    }
    public override string Text { get => base.Text; set => base.Text = string.Empty; }
}

I hope this helps. If you have any other questions do not hesitate to ask. 

Regards,
Nadya | 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
GroupBox
Asked by
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or