OpenAccess with DataForm

7 posts, 1 answers
  1. Troy
    Troy avatar
    8 posts
    Member since:
    Sep 2010

    Posted 09 Aug 2011 Link to this post

    I'm new to Open Access, WPF and XAML.
    My problem is I'm using an OpenAccess reverse-modelled table as the source for a WPF DataForm.
    Everything works great as long as I 'Edit' rows but...
     - can't Add (button is disabled)
     - can't Delete (button is disabled)
     - can't Cancel an edit (button is disable)
    Committing an Edit works great.  Navigation works Great.

    Am I missing a setting in my Model, WPF or in XAML?

    Thanks...
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 15 Aug 2011 Link to this post

    Hello Troy,

    I have tested the case, but unfortunately I was not able to reproduce the issue. May you take a look at the sample attached to verify whether there are no misunderstandings ? 



    Regards,
    Maya
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Troy
    Troy avatar
    8 posts
    Member since:
    Sep 2010

    Posted 15 Aug 2011 Link to this post

    Thanks Maya!
    I'm running this on VS 2008 so couldn't open the solution (sorry, should have mentioned that).
    BUT, I did see the problem. 
    For the ItemSource you've got ObservableCollection objects.  I've got IQueryiable objects (I was using the same type as in the datacontext).
    So I changed one of mine to an ObservableCollection and it's working great now. 
    I had another issue I thought was unrelated that was fixed also.  I didn't see a way to have the datacontext use something else in the OpenAccess wizard but I don't guess I really need that now. 

    Here is a recap of all the 'symptoms' I ran into on the DataForm control using OpenAccess Q2 2011
    (for any other new-bies searching the Forum)...
      - <FIXED> First Item does not appear in the DataForm Control (hit 'next item' arrow, then 'previous' arrow and there it is) 
      - <FIXED> Add Button not available on DataForm Control  
      - <FIXED> Delete Button not available on DataForm Control  
      - <FIXED> Cancel Button is not available while in Edit Mode on DataForm Control 

    I'm sure similar issues would be seen in other controls...
    Maya (or anyone else), if you could do a quick post to help me understand the behaviors resulting from IQueryable I would greatly appreciate it, there are a couple of those symptoms above that seem odd to have resulted from that.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 16 Aug 2011 Link to this post

    Hi Troy,

    You may take a look at the CustomersViewModel and check the CollectionChanged event of the ObservableCollection Customers. The logic there is the one responsible for the inserting and deleting the items from the data source. Such event is not present for a IQueryable. Furthermore, it does not provide methods for adding and removing any item. Generally, the idea of IQueryable is to provide queryable data source and build query by expression tree. You may take a look at this article for further reference.
    Considering the ability to cancel the changes, you need to implement IEditableObject Interface for your business object. You may run through this article for a hint.
     

    Kind regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  6. Scott Willis
    Scott Willis avatar
    1 posts
    Member since:
    Jun 2005

    Posted 26 Apr 2013 Link to this post

    --- <FIXED> First Item does not appear in the DataForm Control (hit 'next item' arrow, then 'previous' arrow and there it is) 

    This is my exact problem as well, can you give me any suggestions as to what might be the issue here?

    Thanks,
  7. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 26 Apr 2013 Link to this post

    Hello Scott,

    Wil it be possible to provide a bit more details on your scenario ? Do you work with OpenAccess as well ? Did you manage to get the same behavior on the project attached above ? Which version of RadControls are you working with ?  

    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Hiwa
    Hiwa avatar
    21 posts
    Member since:
    Mar 2013

    Posted 29 Apr 2013 Link to this post

    Hello Maya,
    You Attached a great sample.
    Thank You very much
    I think  you forgot "this.DbContext.SaveChanges();" at the end of Add and Remove methods. am I right?
Back to Top
UI for WPF is Visual Studio 2017 Ready