For example, to change the color of "RadButtonElement" when hovering over the container?
8 Answers, 1 is accepted
Hi Serg,
The buttons in the tabbed form are part of a single container. We do not have multiple containers for each button as you have shown in the drawing that you sent us.
You can see that there is one pixel space between the button and the container:
And both buttons are in a single container.
As far as I understand you want the button to be active in the area between the button and the container's border. You can set the margin of the RadButtonElement to "-1" and see if it will help in your case. This will remove the spacing between the buttons and the container.
If you are experiencing a different issue, please feel free to contact us at any time. You can also attach your project, if there is any specific behavior that you wish to show us.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Maybe then it is possible to add some containers to RightItems, which will already contain a button with a given Margin? Is there such a solution?
I would be grateful for a hint on how to implement this.
Hi Serg,
The TabbedForm contains two RadQuickAccessToolBar - left and right. They contain inner container among other primitives and elements. The inner container itself is a complex structure that is holding the buttons. We cannot change how the TabbedForm is designed, because we will break the current behavior.
If you can describe your use case in details, we can try to think of a suggestion for your problem.
In any case, write back with more information and we will see what we can do.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
To get the following result shown in the picture.
Hello Serg,
As far as I understood your problem, here is what I can suggest:
public RadForm1()
{
InitializeComponent();
// Create RadButtonElement
Telerik.WinControls.UI.RadButtonElement radButtonElement = new Telerik.WinControls.UI.RadButtonElement();
radButtonElement.Name = "radButtonElement";
radButtonElement.StretchHorizontally = false;
radButtonElement.StretchVertically = false;
radButtonElement.Text = "Button";
radButtonElement.Click += RadButtonElement_Click;
radButtonElement.Margin = new Padding(2, 2, 0, 0);
radButtonElement.MouseLeave += RadButtonElement_MouseLeave;
// Create LightVisualElement, which will act as a container for the button
Telerik.WinControls.UI.LightVisualElement lightVisualElement = new Telerik.WinControls.UI.LightVisualElement();
lightVisualElement.MouseEnter += LightVisualElement_MouseEnter;
lightVisualElement.MouseLeave += LightVisualElement_MouseLeave;
lightVisualElement.ShouldHandleMouseInput = true;
lightVisualElement.Children.Add(radButtonElement); // add the button to the container
// Add the LightVisualElement to the RightItems' collection
// Note: you can add any RadItem in this collection
this.radTabbedFormControl1.RightItems.AddRange(new Telerik.WinControls.RadItem[] {
lightVisualElement});
}
private void LightVisualElement_MouseEnter(object sender, EventArgs e)
{
// When entering the LightVisualElement, set IsMouseOver to true.
// This will simulate that the mouse pointer is over the button.
Telerik.WinControls.UI.LightVisualElement lve = sender as Telerik.WinControls.UI.LightVisualElement;
if (lve != null && lve.Children.Count >= 1)
{
Telerik.WinControls.UI.RadButtonElement buttonElement = lve.Children[0] as Telerik.WinControls.UI.RadButtonElement;
if (buttonElement != null)
{
buttonElement.IsMouseOver = true;
}
}
}
private void LightVisualElement_MouseLeave(object sender, EventArgs e)
{
// Do not forget to set the IsMouseOver to false, when leaving the control
Telerik.WinControls.UI.LightVisualElement lve = sender as Telerik.WinControls.UI.LightVisualElement;
if (lve != null && lve.Children.Count >= 1)
{
Telerik.WinControls.UI.RadButtonElement buttonElement = lve.Children[0] as Telerik.WinControls.UI.RadButtonElement;
if (buttonElement != null)
{
buttonElement.IsMouseOver = false;
}
}
}
private void RadButtonElement_MouseLeave(object sender, EventArgs e)
{
// We need to keep IsMouseOver to true, when leaving the button
// and set it to false, when leaving the LightVisualElement
Telerik.WinControls.UI.RadButtonElement buttonElement = sender as Telerik.WinControls.UI.RadButtonElement;
if (buttonElement != null)
{
buttonElement.IsMouseOver = true;
}
}
I use LightVisualElement as a container for the RadButtonElement. You can use any container you like instead, I am using LightVisualElement for demonstration purposes.
I have also added code that is setting IsMouseOver through some event handlers - I think that is what you wanted to achieve. I suggest experimenting with this solution to fit it best to your particular needs. You can also adjust the Margins/Paddings of the LightVisualElement and RadButtonElement, so you can achieve your desired result.
If you have further questions, don't hesitate to contact me.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
I thought only controls from Telerik can be added to RightItems.
Hello Serg,
Only Telerik items can be used. You can use elements that inherit RadItem: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/class-hierarchy/raditem.
Regards,
Stoyan
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.