Note: I edited the button shape in smart tag -> edit UI elements ->radButton elements -> shape property ->new custom shap
13 Answers, 1 is accepted
Thank you for writing.
Depending on the theme you might need to set the Shape property of RadButtonElement, the FillPrimitive and the BorderPrimitive. For example with the default theme, setting the Shape on the RadButtonElement will suffice.
Should you still have issues, please let us know which properties precisely you changed so we can replicate the scenario on our end.
I am looking forward to your reply.
Regards,
Stefan
Telerik
Thank you for your support
I created custom shape by edit the shape property of FillPrimitive and BorderPrimitive. I set the default theme for my scenario, custom shape has appeared in my design form but when i'm running the app, the default shape is still coming.
It appears we have an issue when using custom shape at design time with RadButton. The case is logged here, where you can track for status changes: http://feedback.telerik.com/Project/154/Feedback/Details/173156-fix-radbutton-the-shape-is-reset-when-it-is-set-at-design-time-with-the-shape
For the time being, you can apply the shape in code behind:
radButton1.Shape = customShape1;
Should you have any other questions or suggestions, do not hesitate to contact us.
Regards,
Stefan
Telerik
If so, could you make a scenario and send me your demo
Look forward to hearing from you.
One way to do that is to use the CustomShape API e.g.
CustomShape shape1 =
new
CustomShape();
shape1.CreateClosedShape(
new
PointF[] {
new
PointF(0, 0),
new
PointF(30, 0),
new
PointF(0, 30),
new
PointF(30, 20) } );
radButton1.ButtonElement.Shape = shape1;
Alternatively, you can use the shape editor form, to create your shape and then assign it to the desired control(s):
CustomShapeEditorForm form =
new
CustomShapeEditorForm();
CustomShape shape =
new
CustomShape();
shape = form.EditShape(shape);
radButton1.ButtonElement.Shape = shape;
I hope this helps.
Regards,
Stefan
Telerik
Thank you for your support. It works.
i wonder that should i remove the background for the custom shape. when i place custom-shape side by side, they are overlap.
I try to change backcolor and set border visible to hide but it not work
Thank you for your support. It works.
i wonder that should i remove the background for the custom shape. when i place custom-shape side by side, they are overlap.
I try to change backcolor and set border visible to hide but it not work
To clip the control bounds, you should set the ApplyShapeToControl property of the RootElement, and you should also set its Shape.
Let me know how this works for you.
Regards,
Stefan
Telerik
Hi Stefan,
That's work great !
Thank you for your support.
Hello, Telerik. I really have the question in the title. As the creater actually wanted to know something totally different, I cannot set any shapes. There is just no shape (and others) property. How can that happen?
I am using VS 2019 (16.0.0), .NET 4.7.2, C#, WinForms, Telerik UI for WinForms R1 2019.
Hello,
If you want to set a custom shape to RadButton, you can create the shape that you want and just assign it to Shape property of the button as shown below:
RoundRectShape shape = new RoundRectShape(20);
this.radButton1.ButtonElement.Shape = shape;
In addition, you can refer to the following articles:
https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/shapes/custom-shapes
https://docs.telerik.com/devtools/winforms/controls/buttons/button/customizing-appearance/accessing-and-customizing-elements
Should you have further question please let me know.
Regards,
Nadya
Progress Telerik
Hi Nadya,
thanks for the fast answer!
But the problem stays: There is no property "Shape"! Also in the code behind the object doesn't have that field. So how can it leave or do i need to active or install extensions for that...?
Hello,
RadButton offers Shape property which is accessible through RadButtonElement and allows a custom shape to be applied. See the picture below:
This comes out of the box and does not require any extensions to be installed.
If you are not able to see the Shape property could you confirm that you are using RadButton, not the standard MS Button? The standard MS Button does not have Shape property. I attached a project where a RadButton with a custom shape is added. Could you please give it a try and let me know hot it works for you?
Looking forward to your reply.
Regards,
Nadya
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).