We are using the DropDownButtonElement on a RibbonBar, there are a very frustating issue with the RadArrowButtonElement.
On this image it show 5 children, but on code there are 6 children, here is a CopyPase of your CreateChildElements in RadArrowButtonElement.
protected override void CreateChildElements()
{
arrow = new ArrowPrimitive(ArrowDirection.Down);
arrow.Class = "RadArrowButtonArrow";
arrow.AutoSize = false;
arrow.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
overflowArrow = new OverflowPrimitive(ArrowDirection.Down);
overflowArrow.Class = "RadArrowButtonOverflowArrow";
overflowArrow.AutoSize = false;
overflowArrow.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
overflowArrow.Visibility = ElementVisibility.Collapsed;
fillPrimitive = new FillPrimitive();
fillPrimitive.Class = "RadArrowButtonFill";
fillPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
borderPrimitive = new BorderPrimitive();
borderPrimitive.Class = "RadArrowButtonBorder";
borderPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
imagePrimitive = new ImagePrimitive();
imagePrimitive.Class = "RadArrowButtonImage";
imagePrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
imagePrimitive.Alignment = System.Drawing.ContentAlignment.MiddleCenter;
textPrimitive = new TextPrimitive();
textPrimitive.Class = "RadArrowButtonTextGlyph";
textPrimitive.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;
textPrimitive.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
textPrimitive.StretchHorizontally = true;
textPrimitive.StretchVertically = true;
Children.Add(fillPrimitive);
Children.Add(borderPrimitive);
Children.Add(arrow);
Children.Add(overflowArrow);
Children.Add(imagePrimitive);
Children.Add(textPrimitive);
}The problem is that we are changing the ArrowButton size to (6, 0) width, here is the how it looks:
As you can see the triangle is outside the ArrowButton, my first idea was to look the ArrowPrimitive and OverflowPrimitive, but that triangle is on TextPrimitive.
Making this change on RadDropDownButtonElement i was able to "solve" the offset and the size.
base.ArrowButton.TextPrimitive.Font = new Font(base.ArrowButton.TextPrimitive.Font.FontFamily, 6);
I have to comment this to something like: "I dont know why this works, but the triangle is on a child text primitive... So don't erase this line".
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()
{
InitializeComponent();
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";
}
this.radButton1.ButtonElement.ImagePrimitive.SvgImage = RadSvgImage.FromFile(@"..\..\image.svg");
this.radButton1.TextImageRelation = TextImageRelation.TextBeforeImage;
this.radButton1.ButtonElement.ImagePrimitive.ImageLayout = ImageLayout.Zoom;
this.radButton1.ButtonElement.ImagePrimitive.StretchVertically = true;
this.radButton1.ButtonElement.ImagePrimitive.StretchHorizontally = true;Steps to reproduce:
1. Press the left mouse button inside RadToggleSwitch. (MouseDown)
2. Move the mouse 1 px up or down (but still inside the RadToggleSwitch). (MouseMove)
3. If you release the left mouse button now, the switch will not toggle. (MouseUp)
Only if the mouse location at the moment of Press and Release are exactly the same, the toggle action will be triggered.
See attached to reproduce.
Workaround: set it to the element:
radToggleSwitch1.ToggleSwitchElement.Font = new Font("Segoe Script", 18, FontStyle.Regular);
FIX. RadButton does not indicate that it is pressed when it is clicked with key instead of clicking with mouse
To reproduce: - radSplitButton1.DefaultItem = radSplitButton1.Items[0]; - press and hold the action button - the styles are not changed
When you customize a theme for RadSplitButton, you are not able to change the color of the action button element when it is pressed and the drop down is not opened.
Workaround:
this.radSplitButtonElement2.ActionButton.MouseDown+=ActionButton_MouseDown;
this.radSplitButtonElement2.ActionButton.MouseUp+=ActionButton_MouseUp;
private void ActionButton_MouseUp(object sender, MouseEventArgs e)
{
this.radSplitButtonElement2.ActionButton.ButtonFillElement.ResetValue(LightVisualElement.BackColorProperty, ValueResetFlags.Local);
this.radSplitButtonElement2.ActionButton.ButtonFillElement.ResetValue(LightVisualElement.GradientStyleProperty, ValueResetFlags.Local);
}
private void ActionButton_MouseDown(object sender, MouseEventArgs e)
{
this.radSplitButtonElement2.ActionButton.ButtonFillElement.BackColor = Color.Red;
this.radSplitButtonElement2.ActionButton.ButtonFillElement.GradientStyle = GradientStyles.Solid;
}
Use the attached project to reproduce. - The first click should be disabled and the event should fire after the interval in the delay property. Workaround: Me.RadRepeatButton1.Delay = 7000
Workaround: disable the default scaling and adjust the font and minimum size
Me.RadRadioButton1.Font = New Font("Arial", 12, FontStyle.Regular)
Me.RadRadioButton1.ButtonElement.CheckMarkPrimitive.MinSize = New Size(20, 20)
Dim radioPrimitive As RadioPrimitive = Me.RadRadioButton1.ButtonElement.CheckMarkPrimitive.FindDescendant(Of RadioPrimitive)()
radioPrimitive.MinSize = New Size(21, 21)
Public Class CutsomRadioButton
Inherits RadRadioButton
Protected Overrides Sub ScaleControl(factor As SizeF, specified As BoundsSpecified)
End Sub
End Class
Use attached to reproduce. Workaround: radDropDownButton1.DropDownButtonElement.DropDownMenu.MinimumSize = new Size(300,0);
To reproduce: - Set the theme to FluentDark and the set RightToLeft = Yes. Workaround: radToggleSwitch1.RightToLeft = RightToLeft.Yes; radToggleSwitch1.ToggleSwitchElement.Thumb.MinSize = new Size(13, 13); radToggleSwitch1.ToggleSwitchElement.Thumb.Margin = new Padding(2);
See attached.
Workaround:
radCheckBox1.ButtonElement.MouseEnter += CheckMarkPrimitive_MouseEnter;
radCheckBox1.ButtonElement.MouseLeave += CheckMarkPrimitive_MouseLeave;
private void CheckMarkPrimitive_MouseLeave(object sender, EventArgs e)
{
radCheckBox1.ButtonElement.CheckMarkPrimitive.Fill.ResetValue(BorderPrimitive.BackColorProperty, ValueResetFlags.Local);
}
private void CheckMarkPrimitive_MouseEnter(object sender, EventArgs e)
{
radCheckBox1.ButtonElement.CheckMarkPrimitive.Fill.BackColor = Color.Red;
}
To reproduce: - Create a dpi aware application and add a checkbox to it. - Change your DPI setting to 200% and start the application. - The checkmark is not scaled only the text is. Workaround: this.radCheckBox2.ButtonElement.CheckMarkPrimitive.CheckElement.UseFixedCheckSize = false; this.radCheckBox2.ButtonElement.CheckMarkPrimitive.CheckElement.MinSize = new Size(100, 100);
How to reproduce: add several menu items displaying only images to the split button and set the MaximumSize property of the drop-down menu
Workaround:
public RadForm1()
{
InitializeComponent();
this.radSplitButton1.DropDownButtonElement.DropDownMenu.MaximumSize = new Size(30, 0);
RadScrollBarElement element = this.radSplitButton1.DropDownButtonElement.DropDownMenu.PopupElement.FindDescendant<RadScrollBarElement>();
element.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
element.RadPropertyChanging += Element_RadPropertyChanging;
}
private void Element_RadPropertyChanging(object sender, Telerik.WinControls.RadPropertyChangingEventArgs args)
{
if (args.Property.Name == "Visibility")
{
args.Cancel = true;
}
}