Diagram does not refresh till resize

Just started evaluating goDiagram, and am a WPF newbie, so the following is most likely the result of me not doing something correctly. Here goes…

I created a WPF application project, added a reference to GoXam, modified the MainWindow.xaml to add a Diagram control, and then modified the code behind to have an ObservableCollection. I set the collection as DiagramControl.Model.NodesSource and then in a button click, I add some strings my observable collection.

Issue: The diagram does not display the node till I resize the window. Do I have to call DiagramControl.LayoutDiagram?

Following is the code:

MainWindow.xaml



<Grid.ColumnDefinitions>


</Grid.ColumnDefinitions>


    <go:Diagram x:Name="DiagramControl" Grid.Column="1"></go:Diagram>
</Grid>

Code behind:

using System.Collections.ObjectModel;
using System.Windows;

namespace GoDiagramTester
{
///


/// Interaction logic for MainWindow.xaml
///

public partial class MainWindow : Window
{
public ObservableCollection Nodes { get; private set; }

    public MainWindow()
    {
        InitializeComponent();

        Nodes = new ObservableCollection<string>();

        Loaded += (s, e) =>
        {
            DiagramControl.Model.NodesSource = Nodes;
        };
    }

    private void AddNodeButtonControl_Click(object sender, RoutedEventArgs e)
    {
        Nodes.Add("Node" + Nodes.Count.ToString());
    }
}

}

Thanks

When you change any model data, or the model itself, you should do so inside a transaction. Call model.StartTransaction and afterwards call CommitTransaction.

Transactions are not necessary when initializing a model, before assigning it to a Diagram.

Thanks, I modified the code as below and the nodes now show up.

    private void AddNodeButtonControl_Click(object sender, RoutedEventArgs e)
    {
        DiagramControl.Model.StartTransaction("AddNode");
        Nodes.Add("Node" + Nodes.Count.ToString());
        DiagramControl.Model.CommitTransaction("AddNode");
    }