Page Index Toggle Pages: 1 [2]  Send TopicPrint
Hot Topic (More than 10 Replies) Diagram create image shows window (Read 1229 times)
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3486
Joined: Oct 19th, 2005
Re: Diagram create image shows window
Reply #15 - Apr 17th, 2026 at 7:46am
Print Post  
Hi Patryk,

Our developer couldn't reproduce, but try setting this flag to see if it helps:

Code
Select All
DevFlags.ResetRenderersAfterImageExport = true; 



using new build here:

https://www.nuget.org/packages/MindFusion.Diagramming.Wpf/4.3.1-alpha2

Or let us know what we should change in attached project to see the problem.

Regards,
Slavcho
Mindfusion
  

CreateImageTest.zip ( 3 KB | 6 Downloads )
Back to top
 
IP Logged
 
Patryk
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 25
Joined: Jun 13th, 2025
Re: Diagram create image shows window
Reply #16 - Apr 27th, 2026 at 9:54am
Print Post  
Hi Slavcho,

Setting the flag for true helps! Smiley

Although the change should also take into account the implementations of ContainerNode because here the template is still missing Wink

Looking forward to official release.
Best regards
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3486
Joined: Oct 19th, 2005
Re: Diagram create image shows window
Reply #17 - Apr 28th, 2026 at 6:27am
Print Post  
Hi Patryk,

Do you mean ContainerNode's own template disappears after export, or container's child nodes? Does your application override ContainerNode.CreateRenderer too?

Best regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Patryk
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 25
Joined: Jun 13th, 2025
Re: Diagram create image shows window
Reply #18 - Apr 28th, 2026 at 10:45am
Print Post  
Yes, we have our own override CreateRenderer for ContainerNode. I noticed that our nodes did not loose the template but its not only for classes that inherits from ContainerNode Smiley
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3486
Joined: Oct 19th, 2005
Re: Diagram create image shows window
Reply #19 - Apr 28th, 2026 at 11:56am
Print Post  
Sorry, I cannot parse that last sentence Sad Could you show before / after screenshots demonstrating what's hiding after export?

Re CreateRenderer, if caching the result as ControlNode's override you copied above does, check whether it works correctly if you return a new instance instead of caching (ControlNode has some code that moves Control between different views / WPF visual trees, but ContainerNode would not expect a shared renderer at all).

Regards,
Slavcho
Mindfusion
« Last Edit: Apr 28th, 2026 at 3:00pm by Slavcho »  
Back to top
 
IP Logged
 
Patryk
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 25
Joined: Jun 13th, 2025
Re: Diagram create image shows window
Reply #20 - May 13th, 2026 at 12:08pm
Print Post  
Code (C++)
Select All
protected override FrameworkElement CreateRenderer(bool activeView, bool lightweight)
{
   if (Template?.LoadContent() is FrameworkElement visual)
   {
      visual.DataContext = DataContext;

      switch (DataContext)
      {
         case IedsContainerViewModel vm:
            vm.BorderColor = BorderColor(this);
            break;
         case EquipmentContainerViewModel equipmentContainerViewModel:
            equipmentContainerViewModel.BorderColor = BorderColor(this);
            break;
      }

      return visual;
   }

   var renderer = new NodeRenderer { Node = this };
   return renderer;
} 



This is our override for ContainerNode.
It suits our needs but now we have the same issue as we used to have on Diagram nodes before your fix Smiley
Cant you just do the same for containers?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3486
Joined: Oct 19th, 2005
Re: Diagram create image shows window
Reply #21 - May 13th, 2026 at 1:44pm
Print Post  
Hi Patryk,

We'll try to reproduce with this code. To confirm the problem, do your containers appear correctly in exported bitmap but disappear completely from the actual DiagramView, or they lose custom template but continue rendering with default appearance?

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Patryk
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 25
Joined: Jun 13th, 2025
Re: Diagram create image shows window
Reply #22 - May 14th, 2026 at 5:40am
Print Post  
Yes, the exported bitmap looks good. The only issue is that later after the export is completed they disappear from DiagramView Slavcho wrote on May 13th, 2026 at 1:44pm:
Hi Patryk,

We'll try to reproduce with this code. To confirm the problem, do your containers appear correctly in exported bitmap but disappear completely from the actual DiagramView, or they lose custom template but continue rendering with default appearance?

Regards,
Slavcho
Mindfusion

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3486
Joined: Oct 19th, 2005
Re: Diagram create image shows window
Reply #23 - May 15th, 2026 at 11:14am
Print Post  
Hi Patryk,

We still couldn't reproduce, with or without the new flag; please check what our developer tried in attached project.

Are there any other types in the hierarchy between the standard ContainerNode and your custom class that could possibly be caching the returned visual?

Please also try applying your app's DiagramView properties related to virtualization to the test project (lightweight presenters, enable virtualization, etc) to see if reproducing, one of them could be the culprit.

Regards,
Slavcho
Mindfusion
  

CreateImageTest_001.zip ( 5 KB | 2 Downloads )
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint