SelectNode MVVM is null

Hello all,

I need some help with MVVM and GoXam. I try to bind the SelectedNode Property in my View Model. But the value I get is always null. Did I miss sometihing or is the binding wrong? (I know there are similar other posts, but i don’t get it work…)

My .xmal:

DataContext="{Binding Source={x:Static vm:ViewModelManager.ViewModelMain}, Path=ViewModelBatchViewDiagram}"
Title=“BatchViewDiagram”

go:Diagram
Model="{Binding Path=Model, Mode=TwoWay}"
MaximumSelectionCount=“1”
SelectedNode="{Binding Path=SelectedNode, Mode=TwoWay}"

In my ViewModel:

private MyNodeData selectedNode;

public IDiagramModel Model { get { return model; } set { model = value; }}
public MyNodeData SelectedNode
{
get
{
return selectedNode;
}
set
{
selectedNode = value;
OnPropertyChanged(“SelectedNode”);
}
}

First, if you are going to bind Diagram.Model, you should set HasDefaultModel=“False”.

Second, Diagram.SelectedNode is of type Node, not whatever node data type you have in your model.

Hello Walter,

thank you for the reply. I solved the problem with the selected Nodes. But when I set HasDefaultModel as false it will display nothing. Do I have to set another property of my binded Model, too?

Actually, it depends on the order in which the Diagram and its ControlTemplate get applied. If it works without setting HasDefaultModel=“False”, you don’t need to. I misread your XAML.