In Development
Last Updated: 07 Apr 2015 16:46 by ADMIN
Created on: 26 Mar 2014 08:19
Category: Buttons
Type: Bug Report
FIX. RadDropDownButton - when the AutoSize property is set to true and the button is anchored to top, right the button is resized to the right.
To reproduce:
- Add RadDropDownButton to a blank form.
- Set its anchor property to top, right and its AutoSize property to true.
- At runtime set the button text to a long string, you will notice that the button is resized to the right when it should be resized to the left.

To workaround this you can subscribe to the SizeChanged event of the button change its location depending on the new size:
Size prevSize;

public Form1()
    radDropDownButton1.AutoSize = true;

    this.Shown += Form1_Shown;

void Form1_Shown(object sender, EventArgs e)
    prevSize = radDropDownButton1.Size;

    radDropDownButton1.SizeChanged += radDropDownButton1_SizeChanged;

void radDropDownButton1_SizeChanged(object sender, EventArgs e)
    RadDropDownButton button = sender as RadDropDownButton;
    button.Location = new Point(button.Location.X - (radDropDownButton1.Size.Width - prevSize.Width), button.Location.Y);
    prevSize = button.Size;

private void radButton2_Click(object sender, EventArgs e)
    radDropDownButton1.Text = "Very long button text set";