Hello,
After creating a Diagram, MakeBitmap is called on the following diagram:
This is actually a node, whose template contains a large background image:
<DataTemplate x:Key="BackgroundNodeTemplate">
<go:NodePanel go:Part.LayerName="{Binding Path=Data.Layer.Id}"
go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
IsHitTestVisible="False"
go:Part.Visible="{Binding Path=Data.IsVisible}"
go:Node.RotationAngle="{Binding Path=Data.Angle}">
<Image Source="{Binding Path=Data.GroundPlanImagePath}"
Width="{Binding Path=Data.Width}"
Height="{Binding Path=Data.Height}" />
</go:NodePanel>
</DataTemplate>
with three nodes of the same type and two links of the same type atop:
<DataTemplate x:Key="ComponentNodeTemplate">
<StackPanel Style="{StaticResource StatusStackPanelStyle}"
go:Part.SelectionElementName="VisualComponent"
go:Part.Rotatable="True"
go:Part.Visible="{Binding Path=Data.IsVisible}"
go:Node.Location="{Binding Path=Data.Location, Mode=TwoWay}"
go:Part.LayerName="{Binding Path=Data.Layer.Id}"
go:Part.RotateAdornmentTemplate="{StaticResource RotationAdornmentTemplate}"
go:Node.RotationAngle="{Binding Path=Data.Angle, Mode=TwoWay}"
go:Node.LocationSpot="Center">
<go:SpotPanel Width="Auto"
HorizontalAlignment="Center"
go:Part.SelectionAdorned="False"
MouseLeftButtonDown="Node_MouseLeftButtonDown"
MouseEnter="Node_MouseEnterComponent"
MouseLeave="Node_MouseLeaveComponent"
Name="VisualComponent">
<go:NodePanel Sizing="Auto"
go:Node.PortId="Component"
go:SpotPanel.Main="True">
<StackPanel>
<Grid Width="{Binding Path=Data.IconSize.Width}"
Height="{Binding Path=Data.IconSize.Height}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="{Binding Path=Data.Icon}"
Stretch="UniformToFill"
HorizontalAlignment="Center"
VerticalAlignment="Center"></Image>
</Grid>
</StackPanel>
</go:NodePanel>
<!-- some ports -->
...
</go:SpotPanel>
<TextBlock Text="{Binding Path=Data.Text}"
HorizontalAlignment="Center"
FontSize="13"
FontWeight="DemiBold"
Style="{StaticResource StatusNodeTextStyle}" />
<!-- Optional diameter text -->
<StackPanel>
...
</StackPanel>
</StackPanel>
</DataTemplate>
As you can see, those are actually just a background icon with some ports and optional text (you can see that on the top node - the name “L1” and the diameter of the pipe)
As the links are drawn correctly I consider them irrelevant and leave them out here. They’re not much more than a LinkShape with a TextBlock for the length and a text part for the diameter same as for the node.
Now, when MakeBitmap is called the result looks like this:
Some background icons are incorrect and some not visible at all. We do have a node looking like the red square in the right node but the middle one is not visible and the top one is a horizontal line that could be part of another image (we don’t have such an icon, though). Also there are other nodes in the diagram, which are invisible at the moment the image is created (some of them use the red square). How is it possible the images are changed upon creating the BitmapImage?