Data Binding

Probably a pretty generic question…

I am looking to make an interface that presents data in two forms:

  1. a GoXam Dynamic Ports graph
  2. a table (probably datagrid of some sort)

I would like to have them both show the same data and have each updated in realtime when one or the other is changed…

For example the datagrid would have a column that states where the link to the top port comes from. If it gets changed in the data grid view then the GoXam graph will immediately update. and similarly, if the GoXam graph is changed the data grid view will update.

Is this possible using the data binding feature of GoXam?

Yes, that should work, assuming that all the data that you use implement INotifyPropertyChanged and INotifyCollectionChanged. The main issue is that if you want to support undo/redo, you’ll have to make sure that all of the actions performed on the model data start and commit a transaction.

Thanks walter!

Sorry Walter…

Would i be best to set up a DataTable and have the Graph and Gridview both bound to the DataTable?

To do this i need to set up listeners for almost all events? Such as “Node Created”, “LinkDrawn”, “LinkRelinked” etc? or is there a better way of listening for changes to the model so i can keep the DataTable/DataGrid current?

That’s probably possible but a lot of work, because DataTable is not observable according to WPF’s needs.

Note also that a diagram such as the Dynamic Ports sample will require at least three tables, one for nodes , one for ports, and one for links.

Hmmm, true.

I’m not very well versed in INotifyPropertyChanged

Ideally both would work via transactions to update an sql database.

But visually i just wanted one to change with the other in realtime.

are there any basic data binding example projects?

Ie. binding a textfield to the text on a node?

It wouldn’t make sense to try to bind some independent Control to a in a Node template, because Nodes are created and destroyed dynamically, so you could not reasonably try to bind your Control to a particular TextBlock. Instead you would have both your Control and the Node’s TextBlock bound to the same data in the model.

In looking down the list of samples in GoWpfDemo, I suppose “Link Demo” is the first obvious case of having a bunch of Controls that show the state of the selected Node or selected Link. But there isn’t much data binding in that XAML – instead the Buttons have event handlers that modify the model data.