Treeview binding with OpenAccess ObservableCollection

7 posts, 0 answers
  1. Alan
    Alan avatar
    49 posts
    Member since:
    Aug 2009

    Posted 15 Jul 2011 Link to this post

    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.
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 20 Jul 2011 Link to this post

    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!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alan
    Alan avatar
    49 posts
    Member since:
    Aug 2009

    Posted 21 Jul 2011 Link to this post

    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.
  5. Nikola
    Admin
    Nikola avatar
    27 posts

    Posted 26 Jul 2011 Link to this post

    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!

  6. Alan
    Alan avatar
    49 posts
    Member since:
    Aug 2009

    Posted 27 Jul 2011 Link to this post

    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.
  7. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 27 Jul 2011 Link to this post

    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!

  8. Alan
    Alan avatar
    49 posts
    Member since:
    Aug 2009

    Posted 28 Jul 2011 Link to this post

    My Tree is working now!! Telerik support rocks!

    Thanks for your help guys. Al.
Back to Top
UI for WPF is Visual Studio 2017 Ready