jeroenvdv
Topic Author
Posts: 13
Joined: 15 Sep 2014, 20:21

SetDataContext in 1.2 for Unity

12 Mar 2015, 21:20

Hi,

I'm trying to get 1.2 for Unity to work with binding to my viewmodel, but nothing seem to work anymore.

Previously, I would use this:
ModelView _modelView = new ModelView(_manager);
NoesisGUIPanel noesisGUI = GetComponent<NoesisGUIPanel>();
Noesis.Grid grid = noesisGUI.GetRoot<Noesis.Grid>();
grid.SetDataContext (_modelView);
Now:
- "GetRoot" doesn't work anymore (replaced by GetContent? MonoDevelop doesn't recognize GetContent but Unity compiler does...)
- "SetDataContext" is recognized by MonoDevelop, but Unity compiler doesn't accept this.

Help!?
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: SetDataContext in 1.2 for Unity

12 Mar 2015, 23:53

Hi,

Yes, 1.2 API tries to follow WPF API as much as possible, so we had to change lots of things. The most important changes are remarked in the changelog.

The code you posted should look like this now:
ModelView _modelView = new ModelView(_manager);
NoesisGUIPanel noesisGUI = GetComponent<NoesisGUIPanel>();
Noesis.Grid grid = (Noesis.Grid)noesisGUI.GetContent();
grid.DataContext = _modelView; 
I guess if you fix all compiler errors and Sync your MonoDevelop project, it would recognize the new API correctly.

Who is online

Users browsing this forum: No registered users and 1 guest