How Set Events After Load RadPanorama Layout

0 Answers 113 Views
Panorama
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
JeffSM asked on 19 Jul 2021, 03:52 PM

This is not a question, but a help for my future me!

When you load a layout your RadTitleElement miss events, you cannot directly set .Click event, for example, on the RadTitleElement object memory var.

You need to find out the element and set the event.

So the code below shows how to do it.


void LoadLayout(RadPanorama panorama, string userFileConfig) { panorama.LoadLayout(fileUserConfig); Fire("radTileElement1").click += (ss,ee) => DoSomething(); Fire("myCustomElementName").click += DoSomething2(); //.... } #if (DEBUG)

private string missingBlocks { get; set; } = "";

#endif

private RadTileElement Fire(string name) { for (var n = 0; n < radPanorama1.Groups.Count(); n++) { var grp = (TileGroupElement)radPanorama1.Groups[n]; foreach (RadTileElement item in grp.Items) { if (item.Name.IsEquals(name)) return item; } } #if (DEBUG) missingBlocks += ";" + name;

// This guide you if goes wrong any .Name property System.Diagnostics.Debug.WriteLine(missingBlocks); #endif

return new RadTileElement(); }

 

How use it?

 

Any were you like restore a layout:
LoadLayout(radPanorama1, mySavedLayoutFile);

 

#jefferson2020

 

 

Nadya | Tech Support Engineer
Telerik team
commented on 20 Jul 2021, 01:07 PM

Hello, Jeff,

Thank you for sharing this code snippet with the community!

When using saving/loading layout the panorama settings are preserved in an XML file so you can not access the RadTileElement directly. As you have already found out, it is necessary first to find the element, then subscribe to the event.

If you have any other questions or concerns do not hesitate to contact us.

No answers yet. Maybe you can help?

Tags
Panorama
Asked by
JeffSM
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or