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

Using Callout with buttons baked in to RadImageEditorUI

2 Answers 84 Views
Callout
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Veteran
Richard asked on 30 Mar 2021, 12:25 PM

Is there any way to assign a callout to (say) the Open Image Button of the RadImageEditorUI?

I can't seem to find any way to get a reference to a button within the RadImageEditorUI control so I can assign it to a callout.

Thanks

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 02 Apr 2021, 11:25 AM

Hello Richard,

The buttons in the RadImageEditorUI's ControlTemplate don't have public accessors. The easiest way to get those is to use the ChildrenOfType<T> extension method. Here is an example in code:

private void RadImageEditorUI_Loaded(object sender, RoutedEventArgs e)
{
	var editorUI = (RadImageEditorUI)sender;
	var templateButtons = editorUI.ChildrenOfType<RadButton>();
	RadButton openButton = templateButtons.FirstOrDefault(b => b.Command == editorUI.OpenCommand);
	
	var callout = new RadCallout()
	{ 
		Background = Brushes.DeepSkyBlue,
		Content = "Click this button to open an image from the file system.",
		ArrowAnchorPoint = new Point(-0.02, 0.5),
		ArrowBasePoint1 = new Point(0, 0.40),
		ArrowBasePoint2 = new Point(0, 0.60)
	};

	CalloutPopupSettings settings = new CalloutPopupSettings()
	{
		Placement = System.Windows.Controls.Primitives.PlacementMode.Right,
	};

	CalloutPopupService.Show(callout, openButton, settings);
}

I hope this helps.

Regards,
Martin Ivanov
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/.

0
Richard
Top achievements
Rank 2
Veteran
answered on 06 Apr 2021, 07:49 PM

Thanks Martin,

I didn't realise there was an extension method for that - works like a charm.

Tags
Callout
Asked by
Richard
Top achievements
Rank 2
Veteran
Answers by
Martin Ivanov
Telerik team
Richard
Top achievements
Rank 2
Veteran
Share this question
or