This is a migrated thread and some comments may be shown as answers.

Treeview binding with OpenAccess ObservableCollection

6 Answers 122 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Iron
Alan asked on 16 Jul 2011, 04:32 AM
Hi, just wondering if you could help me out with an example that shows how to databind a WPF treeview to an

ObservableCollection

from an OpenAccess entity diagram. The sql db table simply contains two fields: WBSID (Guid) - PK, Name (varchar(50) &  WBSParentID (Guid).

Thanks Telerik. Al.

6 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 20 Jul 2011, 03:56 PM
Hi Webal,

My advice is to download the ORM SDK from here. One of the MVVM examples show how to bind a GridView to an ObservableCollection. Take a look at it. The approach is very similar and you'll find no difficulties implementing it for RadTreeView. Give it a try and let me know if you experience any issues. I'd be glad to further assist you.

Greetings,
Kiril Stanoev
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alan
Top achievements
Rank 1
Iron
answered on 21 Jul 2011, 03:21 PM
Hi Kiril,

Thank you for your reply.

I did found from another Forum question that it would be a good idea to download the OpenAccess sdk, which I did before I received your reply to me. Being quite new to this type of programming I was just after a specific example and thought that you may have had one. If you do that would save me a bucket of time not having to fubble and learn the syntax. If not I'll see how I go.

Thanks again. Al.
0
Nikola
Telerik team
answered on 26 Jul 2011, 05:16 PM
Hello Webal,

Please find attached the requested demo. It uses the Employees table from the Northwind Database which has a circular reference, like your table. Note that you may have to update the OpenAccess references, so they match the version you have installed. I hope that helps.

All the best,
Nikola
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alan
Top achievements
Rank 1
Iron
answered on 27 Jul 2011, 12:56 PM
Hi Nikola,

Thank you so much for the example. I have been trying to work it out (unsuccessfully...) and it was a welcome relief to see your post!

When running in debug mode I did get an exception error:

'The invocation of the constructor on type 'OpenAccessRadTreeViewExample.MainWindow' that matches the specified binding constraints threw an exception.'

Turns out to be a build error on the table element Photo:
Warning 1 Explicit change tracking required for the array field OpenAccessRadTreeViewExample.Employee._photo. [class=OpenAccessRadTreeViewExample.Employee] [field=_photo] C:\Users\PCS\Documents\VS2010\Treeview_examples\OpenAccessTreeView\OpenAccessRadTreeViewExample\Employee.generated.cs 28 7 OpenAccessRadTreeViewExample

After deleting this table element from the entity diagram I was able to run the project successfully. Do you know what causes this error?

Thanks. Al.
0
Alexander
Telerik team
answered on 27 Jul 2011, 02:52 PM
Hello Al,

You can find more information about this warning in this article. It basically means that OpenAccess is unable to track changes within object arrays (in this case a byte array), unless the whole array is replaced with another.
However, this warning should not prevent your project from building, everything should work as expected, so you can just ignore it.

Greetings,
Alexander
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alan
Top achievements
Rank 1
Iron
answered on 28 Jul 2011, 03:04 PM
My Tree is working now!! Telerik support rocks!

Thanks for your help guys. Al.
Tags
TreeView
Asked by
Alan
Top achievements
Rank 1
Iron
Answers by
Kiril Stanoev
Telerik team
Alan
Top achievements
Rank 1
Iron
Nikola
Telerik team
Alexander
Telerik team
Share this question
or