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

Custom RadSplitButton

8 Answers 166 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
miki
Top achievements
Rank 1
miki asked on 31 Dec 2014, 03:54 PM
I have RadSplitButton with  2 options (2 radMenuItems)
Is it possible to add near to one of my items a RadSpinEditor in order to give the user the option to choose specific value number ?

8 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Jan 2015, 11:50 AM
Hi Miki,

Thank you for writing.

Yes, you can add spin control as menu item in RadSplitButton. Here is an example:
RadSpinElement spinElement = new RadSpinElement();
splitButton.Items.Add(spinElement);

More information regarding this matter is available here: http://www.telerik.com/help/winforms/menus-menu-working-with-radmenu-items-nesting-controls-in-menu-items.html.

I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

Regards,
Stefan
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.

 
0
miki
Top achievements
Rank 1
answered on 02 Jan 2015, 05:47 PM
That's work great !
can i also add simple text before this element ?
0
miki
Top achievements
Rank 1
answered on 02 Jan 2015, 06:15 PM
I add RadLabelElement before this new RadSpinElement but is it possible to add this RadLabelElement in the same line of one of my radMenuItem ? (not above or after)
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Jan 2015, 01:10 PM
Hello Miki,

Thank you for writing back.

You can use a StackLayoutElement as a container and add the RadLabelElement and the RadSpinElement to its Children collection:
public Form1()
{
    InitializeComponent();
 
    StackLayoutElement stack = new StackLayoutElement();
    stack.StretchHorizontally = true;
    RadLabelElement label = new RadLabelElement();
    label.Text = "text";
    RadSpinElement spinElement = new RadSpinElement();
    stack.Children.Add(label);
    stack.Children.Add(spinElement);
 
    this.radSplitButton1.Items.Add(stack);
}

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Desislava
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.

 
0
miki
Top achievements
Rank 1
answered on 08 Jan 2015, 11:54 AM
That's work great thanks, BTW i try t define new size:

spinElement .Size = new System.Drawing.Size(50, 20);

but it seems that it has no effect and nothing changed, am i doing something wrong ?
0
Stefan
Telerik team
answered on 12 Jan 2015, 11:52 AM
Hi Miki,

You can use the MInSize/MaxSize properties to set the spit element size.

Regards,
Stefan
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.

 
0
miki
Top achievements
Rank 1
answered on 12 Jan 2015, 05:02 PM
Thanks that's works fine.

BTW is it possible to insert Image before the text and not between the text and the RadSpinElement ?
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Jan 2015, 09:24 AM
Hello Miki,

Thank you for writing back.

In order to insert an image before the text, you can set the RadLabelElement.Image property to the desired picture and set the RadLabelElement.TextImageRelation property to ImageBeforeText:
StackLayoutElement stack = new StackLayoutElement();
stack.StretchHorizontally = true;
RadLabelElement label = new RadLabelElement();
label.Image = Properties.Resources.crop;
label.TextImageRelation = TextImageRelation.ImageBeforeText;
label.Text = "text";
RadSpinElement spinElement = new RadSpinElement();
stack.Children.Add(label);
stack.Children.Add(spinElement);
 
this.radSplitButton1.Items.Add(stack);

I hope this information helps. If you have any additional questions, please let me know.
 
Regards,
Desislava
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.

 
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
miki
Top achievements
Rank 1
Answers by
Stefan
Telerik team
miki
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or