Hi there,
My model seems very easy:
public class State
{
public string Name {get; set;}
public State(string name)
{ Name= name;}
}
public class Transition
{
public string Name {get; set;}
public State Source{ get; set;}
public State Target {get; set;}
public Transition(string name, State source, State target)
{
Name = name;
Source = source;
Target = target;
}
}
public class DiagrammViewModel
{
public ObservableCollection<State> States{get; set;}
public ObservableCollection<Transition> Transitions{get; set;}
public DiagrammViewModel(IEnumerable<State> states, IEnumerable<Transition> transitions)
{
States = new ObservableCollection<State>(states);
Transitions = new ObservableCollection<Transition>(transitions);
}
}
And I I create data:
var idle = new State("Idle");
var running = new State("Running");
var stopping = new State("Stopping");
var stopped = new State("Stopped");
var holding = new State("Holding");
var held = new State("Held");
var run = new Transition("Run", idle, running);
var stop = new Transition("Stop", running, stopping);
var stopped = new Transition("", stopping, stopped);
var reset = new Transition("Reset", stopped, idle);
var hold = new Transition("Hold", running, holding);
var holdingHeld = new Transition("", holding, held);
var diagrammViewModel = new DiagrammViewModel(states, transitios);
It seems like this:
https://yadi.sk/i/k0vQeJymcWQNK
I want to bind this data to diagramModel, but I can`t bind directly to Nodes and Connections properties
And if I bind diagramModel to State collection, I recive flat diagram without any connection.
How can I do it?
There are only hierarhical data binding in samples that distributed with essential studio
Now I fill Nodes and Collections prorerties of DiagrammModel via code, but it cause
inconvenienceP.S. Sorry for my English:)