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

Add button to Image editor side bar?

1 Answer 65 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Rooster
Top achievements
Rank 1
Rooster asked on 20 Oct 2020, 01:43 PM

Hello Telerik Support Team,

I'm trying to add a custom button for the RadImageEditor for my application. When I try to do so using

RadMenuItem cst = new RadMenuItem("Item");

radImageEditor1.ImageEditorElement.CommandsElement.CommandsStackEleemnt.Children.Add(cst);

This does get me the button I need, but I am unable to extend add an event handler to this button.

However If I were to create a button and add it to the element by extending RadMenuItem to override the onclick event within a custom class like so:

CustomMenuItem custom = new CustomMenuItem("CustomMenuItem");

radImageEditor1.ImageEditorEleemnt.CommandsElement.CommandsStackElement.Children.Add(custom);

This will get me a flat generic box the form in which I am unable to modify the style of the button to fit with the rest of the form, however this approach will allow me to define my event handler. 

How can I go about it to create a proper button within the image editor side bar (to clarify the side bar below the command elements, and be able to setup the onclick to run the function needed as intended?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 22 Oct 2020, 03:48 PM

Hello, Joey,

If I understand your requirement correctly you would like to add a new item to the RadImageEditor control and you would like to handle the click event of this item. If this is what you want, I would like to note that RadMenuItem has a Click event which you can use:

 public RadForm1()
 {
     InitializeComponent();

     RadMenuItem cst = new RadMenuItem("Item");
     cst.Click += this.Cst_Click;
     radImageEditor1.ImageEditorElement.CommandsElement.CommandsStackElement.Children.Add(cst);
 }
 private void Cst_Click(object sender, EventArgs e)
 {
     //TO DO
 }

I hope this helps. Should you have other questions do not hesitate to write back.

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).

Tags
ImageEditor
Asked by
Rooster
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or