Custom RadButtonElement in "Type Here" RadStatusStrip

3 posts, 0 answers
  1. Carlinhos
    Carlinhos avatar
    2 posts
    Member since:
    Jul 2012

    Posted 13 Nov 2012 Link to this post

    I have a CustomRadButtonElement inheriting from RadButtonElement. My objective is to add it to the list of components present in RadStatusStrip "Type Here". Is that Possible?
  2. Carlinhos
    Carlinhos avatar
    2 posts
    Member since:
    Jul 2012

    Posted 13 Nov 2012 Link to this post

    Problem Solved
    public class CRadButtonElement : RadButtonElement
     
        protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            //My Code ..
            base.OnMouseDown(e);
        }
     
        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
        {
            //My Code ..
            base.OnMouseUp(e);
        }
     
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(RadButtonElement);
            }
        }
    }


        [ToolboxItem(true)]
       public class CRadStatusStrip : RadStatusStrip
       {
     
     
           public CRadStatusStrip()
               : base()
           {
               base.Items.ItemTypes = new Type[] { typeof(CRadButtonElement)};
           }
       }
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 14 Nov 2012 Link to this post

    Hi Carlos,

    Thank you for sharing your solution with the community.

    Your approach is correct but it is suitable only for simple controls like RadStatusStrip, RadListControl etc. For complex controls like RadRibbonBar you should add a regular button in design time and then open the Designer file and replace the type from RadButtonElement to your CustomRadButtonElement.

    I hope that you find this information useful.

    All the best,
    Peter
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top