Diagram Render in Collapsed / Hidden Visibility

1 Answer 120 Views
Diagram
Mrugendra
Top achievements
Rank 1
Iron
Mrugendra asked on 19 Aug 2022, 05:16 PM

We have created an app that allows the user to create templates using the diagram control, and then bind data (several records) to print / export to PDF.  The bind operation does not need the diagram to be visible, and its a desired behavior, the user can click a button and we work with the diagram in the background (bind each record, export the image) without the user seeing the diagram loading every record.

The issue we have encountered is that if the diagram has collapsed visibility or is not visible, the items do not render (they have their isLoaded property set to false). This might be an optimization on the Diagram to render only visible items, however its causing an issue for our use case. 

How do we make the diagram load and render all items even when its not visible?  (Or what trick can we use to keep the diagram hidden and yet have it render?)

We also wish to optimize the loading speed in this scenario, suggestions to speed up diagram loading saved items would really help us, as you can imaging we do not need any UI features such as Dragging, Copy/Paste/Undo etc. in the data-bind and export mode.

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 24 Aug 2022, 12:18 PM

Hello Mrugendra,

The observed result is a design decision for the RadDiagram control, which is done, in order for the control to have a higher performance. However, this behavior can still be worked around. To do so, when executing the export logic, you could utilize the Measure and Arrange methods of the RadDiagram control. 

The following code snippet shows a sample implementation of the abovementioned suggestion:

private void MyExportMethod() { if (myDiagram.Visibility != Visibility.Visible) { //Sample values set for the Measure and Arrange methods myDiagram.Measure(new Size(600, 600));} myDiagram.Arrange(new Rect(new Size(600, 600)));

//Export logic } }

With this said, could you give this suggestion a try?

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Diagram
Asked by
Mrugendra
Top achievements
Rank 1
Iron
Answers by
Stenly
Telerik team
Share this question
or