I am playing with GoXam Silverlight 4 and it seems we will move on to GoXam very soon. I start look at NodeFigures example, since it is the easiest one (I think).
- I would like to apply MVVM to my application, extract the business logic to the ViewMode class without writing any code in the xxx.xaml.cs file. Please point me how to set the following int Xaml instead of in the code behind file.
myDiagram.Model.NodesSource = figures;
myDiagram.Model.Modifiable = false;Here is my ModelView classnamespace MyApps.NodeFigures
{
public partial class NodeFigures : UserControl
{
public NodeFigures()
{
InitializeComponent();
var figures = new List();
var i = 0;
while (Enum.IsDefined(typeof(NodeFigure), i))
{
figures.Add((NodeFigure)i++);
}
myDiagram.Model.NodesSource = figures;
myDiagram.Model.Modifiable = false;
}
}
}
- We will create a node with an Image and serveral texts below the image; the node is resizable. For example, a border around the whole node, resize the border, the image and texts will be resized. So I added a grid in NodeFigureTemplate, unfortunately the figure disappear. How can I display both figure and text?
<go:NodePanel go:Node.SelectionElementName="Shape" go:Node.SelectionAdorned="True"
go:Node.Resizable="True" go:Part.Text="{Binding Path=Data}">
<Path x:Name="Shape" Grid.Row="0" go:NodePanel.Figure="{Binding Path=Data}"
Stroke="Black" StrokeThickness="3" Fill="LightGray"
Width="100" Height="100" MinWidth="20" MinHeight="20" />
<TextBlock Grid.Row="1" Text="{Binding Path=Data}" TextAlignment="Center" TextWrapping="Wrap"
VerticalAlignment="Center" HorizontalAlignment="Center" />