Hi Stoyan,
the exported PDF file looks muuuuch better now and child controls are positioned correctly but i found something else isnt included in WPF-Visual-tree to PDF translation layer.
After ive started this topic, my custom node template got more complicated. Ive tried variuos visual upgrades onto it and its structure grown up a bit.
Heres the template:
<UserControl x:Class="MindfusionTesting.Templates.ObjectNodeTemplate"
xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
>
<Border VerticalAlignment="Top" HorizontalAlignment="Left" Name="brdMain" CornerRadius="8,8,8,8">
<Grid VerticalAlignment="Top" HorizontalAlignment="Left">
<Border Name="mask" Background="Black" CornerRadius="6">
</Border>
<Rectangle Name="rectBackground">
<Rectangle.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/>
</Rectangle.OpacityMask>
</Rectangle>
<StackPanel Name="spMain" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid Name="gImgMain" VerticalAlignment="Top" Margin="5,5,0,0">
<Border Name="maskImage" Background="White" CornerRadius="6" >
</Border>
<Rectangle>
<Rectangle.OpacityMask>
<VisualBrush Visual="{Binding ElementName=maskImage}"/>
</Rectangle.OpacityMask>
</Rectangle>
<Image MaxHeight="40" MaxWidth="40" Name="imgMain" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5"></Image>
</Grid>
<StackPanel Orientation="Vertical" Margin="10" VerticalAlignment="Top">
<TextBlock Name="tbxName" Text="{Binding Path=Name}" TextWrapping="Wrap" Foreground="Orange" HorizontalAlignment="Center" FontWeight="Bold" FontSize="12"
VerticalAlignment="Top" Margin="10,0,10,10" MaxWidth="150"></TextBlock>
<Expander HorizontalAlignment="Left" VerticalAlignment="Top" Header="More info..." Cursor="Hand" Foreground="Orange" FontWeight="Bold" FontSize="8"
Name="expMain" ExpandDirection="Down" IsExpanded="False" >
<Grid VerticalAlignment="Top" Cursor="SizeAll">
<Border Name="maskExpander" Background="Orange" CornerRadius="0,0,6,6" >
</Border>
<Rectangle Name="rectMoreInfo">
<Rectangle.OpacityMask>
<VisualBrush Visual="{Binding ElementName=maskExpander}"/>
</Rectangle.OpacityMask>
</Rectangle>
<StackPanel Orientation="Vertical" Margin="5" >
<StackPanel Orientation="Horizontal">
<TextBlock Text="Type:" Foreground="Black" HorizontalAlignment="Left" FontWeight="Normal"
VerticalAlignment="Top" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="{Binding Path=Type}" TextWrapping="Wrap" Foreground="Black" HorizontalAlignment="Left" FontWeight="Bold"
VerticalAlignment="Top"></TextBlock>
</StackPanel>
</StackPanel>
</Grid>
</Expander>
</StackPanel>
</StackPanel>
</Grid>
</Border>
</UserControl>
The main problem now is with Rectangle.OpacityMask ("rectBackground" i.e.) i suppose. Ill send You an email with how the diagram originally looks (exported into graphical file) and Exported PDF file to compare.
Besides when using LinearGradientBrush as Rectangle.Fill property when i use more than 2 gradient stops the gradient is wisible as 1 color in PDF file.
i.e. I use:
<LinearGradientBrush x:Key="lgbDefault" StartPoint="0,0" EndPoint="0,1" >
<GradientStop Color="Gray" Offset="0.2"/>
<GradientStop Color="Black" Offset="0.85"/>
<GradientStop Color="Gray" Offset="1"/>
</LinearGradientBrush>
as a brush for default nodes and assign it into Rectangle programmatically from resources
(this one dont work with PDF export), but for some nodes i use other brush like:
<LinearGradientBrush x:Key="lgbRoot" StartPoint="0,0" EndPoint="0,1" >
<GradientStop Color="Red" Offset="0.2"/>
<GradientStop Color="Black" Offset="0.85"/>
</LinearGradientBrush>
and this one is exported correctly
I appreciate work of all You guys
Btw, will this fix (meant all this PDF exporting stuff) be included in the new full release?
Best regards,
rafaello