Custom RadSplitButton

9 posts, 0 answers
  1. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 31 Dec 2014 Link to this post

    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 ?
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 02 Jan 2015 Link to this post

    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.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 02 Jan 2015 in reply to Stefan Link to this post

    That's work great !
    can i also add simple text before this element ?
  5. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 02 Jan 2015 Link to this post

    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)
  6. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 07 Jan 2015 Link to this post

    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.

     
  7. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 08 Jan 2015 in reply to Dess Link to this post

    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 ?
  8. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Jan 2015 Link to this post

    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.

     
  9. miki
    miki avatar
    37 posts
    Member since:
    Dec 2014

    Posted 12 Jan 2015 in reply to Stefan Link to this post

    Thanks that's works fine.

    BTW is it possible to insert Image before the text and not between the text and the RadSpinElement ?
  10. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 15 Jan 2015 Link to this post

    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.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready