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

OpenAccess with DataForm

6 Answers 111 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 1
Troy asked on 10 Aug 2011, 12:39 AM
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...

6 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 15 Aug 2011, 07:23 AM
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 >>
0
Troy
Top achievements
Rank 1
answered on 15 Aug 2011, 09:44 PM
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.
0
Maya
Telerik team
answered on 16 Aug 2011, 03:30 PM
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 >>

0
Scott Willis
Top achievements
Rank 1
answered on 26 Apr 2013, 09:33 PM
--- <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,
0
Maya
Telerik team
answered on 26 Apr 2013, 09:58 PM
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.

0
Hiwa
Top achievements
Rank 2
answered on 29 Apr 2013, 06:11 PM
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?
Tags
DataForm
Asked by
Troy
Top achievements
Rank 1
Answers by
Maya
Telerik team
Troy
Top achievements
Rank 1
Scott Willis
Top achievements
Rank 1
Hiwa
Top achievements
Rank 2
Share this question
or