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

RadMenuButtonItem sizing in RadDropDownButon

3 Answers 96 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Trey
Top achievements
Rank 2
Trey asked on 21 Jan 2015, 02:22 PM
I have a radDropDownButton that I am dynamically adding radMenuButtonItems to:

RadMenuButtonItem bi = new RadMenuButtonItem();
bi.Text = string.Format("Item {0}", counter);
bi.TextAlignment = ContentAlignment.MiddleLeft;
Font fnt = new Font("Arial Rounded MT", 18.0f);
bi.Font = fnt;
bi.Click += new EventHandler(radDropDownButton_Item_Click);
bi.AutoSize = false;
bi.Size = new Size(radDropDownButton_Caregivers.Size.Width, 50);
radDropDownButton.Items.Add(bi);


When I size the button item, it is sizing the space around the button item, but not the actual button item.  How can I size the button item?  See attached image (blue arrows).

Also, how can I remove the space to the left of the button items, which is causing whitespace to the right of the button items?  See attached image (red arrows)

3 Answers, 1 is accepted

Sort by
0
Todor Vyagov
Telerik team
answered on 22 Jan 2015, 03:55 PM
Hi Trey,

Thank you for writing.

I edited your image and now you can see the element structure.
You need to set the ButtonElement's property MinSize.
RadMenuButtonItem bi = new RadMenuButtonItem();
bi.Text = "My Item";
bi.TextAlignment = ContentAlignment.MiddleLeft;
Font fnt = new Font("Arial Rounded MT", 18.0f);
bi.Font = fnt;
bi.ButtonElement.MinSize = new Size(radDropDownButton1.Size.Width, 50);
radDropDownButton1.Items.Add(bi);

To remove the LeftColumnElement you can use the following code:
RadDropDownMenuElement menuElement = this.radDropDownButton1.DropDownButtonElement.DropDownMenu.PopupElement as RadDropDownMenuElement;
menuElement.Layout.LeftColumnMinWidth = 0;

I hope this helps.

Regards,
Todor
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
Trey
Top achievements
Rank 2
answered on 22 Jan 2015, 08:14 PM
Not working.

RadMenuButtonItem ri = new RadMenuButtonItem();
ri.Text = string.Format("Item {0}", counter); //cg.Name);
ri.TextAlignment = ContentAlignment.MiddleLeft;
Font fnt = new Font("Arial Rounded MT", 18.0f);
ri.Font = fnt;
ri.Click += new EventHandler(radDropDownButton_Item_Click);
ri.AutoSize = true;
ri.Size = new Size(radDropDownButton.Size.Width, 75);
ri.MinSize = new Size(radDropDownButton.Size.Width, 75);
radDropDownButton_Caregivers.Items.Add(ri);

When I set AutoSize to false, it wouldn't drop down at all.
0
Accepted
Todor Vyagov
Telerik team
answered on 26 Jan 2015, 08:55 AM
Hi Trey,

Thank you for writing back.

In order to change the RadMenuButtonItem button size you need to set its ButtonElement.MinSize property as I mentioned.
bi.ButtonElement.MinSize = new Size(radDropDownButton1.Size.Width, 50);

I have attached my test project. Feel free to try it and if you continue experiencing any issues get back to me with it so I can investigate the precise case. Thank you in advance.

I am looking forward to your reply. 

Regards,
Todor
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
Trey
Top achievements
Rank 2
Answers by
Todor Vyagov
Telerik team
Trey
Top achievements
Rank 2
Share this question
or