Is it possible to use user controls as node content in Silverlight?
I dont see any samples about this scenario in your demo.
Cuold you please provide one?
Are there any limitations?
Thx
Is it possible to use user controls as node content in Silverlight?
Yes you can. No, there aren’t any limitations.
I used Expression Blend to create:
[code]
<Grid x:Name="LayoutRoot">
<Canvas Margin="0">
<Rectangle Stroke="Black" Height="59" Width="70">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF005322" Offset="1"/>
<GradientStop Color="#FF00C350"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Ellipse Stroke="Black" Height="63" Width="80" Canvas.Left="20" Canvas.Top="37">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#FF0848F4" Offset="1"/>
<GradientStop Color="#FF7E9AE4"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<TextBlock Canvas.Left="70" Text="{Binding Data.Key}" TextWrapping="Wrap"
Width="30" FontStyle="Italic" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"
Height="37" TextAlignment="Center" FontSize="12"/>
</Canvas>
</Grid>
[/code]
I didn’t add anything to the code-behind.
Then for my Diagram:
<DataTemplate x:Key="UserControl1Template">
<local:UserControl1 Width="100" Height="100" />
</DataTemplate>
and
<go:Diagram x:Name="myDiagram" Padding="10"
NodeTemplate="{StaticResource UserControl1Template}" />
results in something like:
Thank you!
You’re welcome.
I was editing my post at the same time you replied, so it may be a bit more complete now.