How to reset Thumbnail of RadDiagramNavigationPane?

1 Answer 25 Views
Diagram
Aeroth
Top achievements
Rank 1
Aeroth asked on 10 Jul 2021, 01:13 PM

I tried to reset Thumbnail as below code snippet, but it doesn't work as I expected.

this.xNavigationPane.Diagram = null;
this.xNavigationPane.RefreshThumbnail();

Could you show me how to make it like no RadDiagram is attached to RadDiagramNavigationPane? Like below screenshot,

Thanks!

Aeroth

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 14 Jul 2021, 10:01 AM

Hello Aeroth,

Thank you for the shared images.

Generally speaking, clearing the Items from the RadDiagram will also clear them from the thumbnail.

If you don't want that, an approach which you can try is to clear the Image element inside it by manually setting its Source property to null. Basically, you can use the ChildrenOfType<T>() Telerik extension in order to get the image and set its source to null. Here is what I have in mind:

this.myNavigationPane.Diagram = null;
    var navigationPaneImage = this.myNavigationPane.ChildrenOfType<Image>().FirstOrDefault();
    navigationPaneImage.Source = null;

I hope you find this helpful.

Regards,
Vladimir Stoyanov
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/.

Aeroth
Top achievements
Rank 1
commented on 14 Jul 2021, 02:32 PM

Thanks for the solution, setting the Source to null does clear the thumbnail but it won't work when I set a new diagram to it. My workaround is to create an empty Diagram sitting behind my main control (TabControl). When there's no tab (no diagram to show) I'll set the empty diagram to the NavigationPane.
Vladimir Stoyanov
Telerik team
commented on 16 Jul 2021, 09:23 AM

Thank you for the update. The approach that you have adopted seems reasonable and you can stick to it, if its suitable for your scenario. 
Tags
Diagram
Asked by
Aeroth
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or