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

Custom RadButtonElement in "Type Here" RadStatusStrip

2 Answers 115 Views
StatusStrip
This is a migrated thread and some comments may be shown as answers.
Carlinhos
Top achievements
Rank 1
Carlinhos asked on 13 Nov 2012, 01:06 PM
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 Answers, 1 is accepted

Sort by
0
Carlinhos
Top achievements
Rank 1
answered on 13 Nov 2012, 07:26 PM
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)};
       }
   }
0
Peter
Telerik team
answered on 14 Nov 2012, 01:16 PM
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.
Tags
StatusStrip
Asked by
Carlinhos
Top achievements
Rank 1
Answers by
Carlinhos
Top achievements
Rank 1
Peter
Telerik team
Share this question
or