Hi,
You could show it using a textblock overlayed on top of the diagram -
<Grid>
<ScrollViewer>
<diag:Diagram ... />
</ScrollViewer>
<TextBlock
x:Name="watermark"
Text="Please add, connect items to make diagram"
FontSize="24"
Foreground="Red"
Opacity="0.6"
VerticalAlignment="Center"
HorizontalAlignment="Center"
IsHitTestVisible="false" />
</Grid>
and bind visibility to diagram's Items.Count using a value converter, or just set it to hidden from NodeCreated event handler -
void OnNodeCreated(object sender, NodeEventArgs e)
{
watermark.Visibility = Visibility.Collapsed;
}
Alternatively draw it from DrawForeground event handler -
diagram.DrawForeground += (sender, args) =>
{
if (diagram.Items.Count == 0)
{
diagram.DrawStyledText(
args.Graphics,
"<color=#FF0000>Please add, connect items to make diagram</color>",
new TextAttributes(new Font("Arial", 24))
{
TextAlignment = TextAlignment.Center
},
diagram.Viewport);
}
};
diagram.InvalidateForeground();
void OnNodeCreated(object sender, NodeEventArgs e)
{
diagram.InvalidateForeground();
}
Regards,
Slavcho
Mindfusion