Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 514133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:29:35+00:00 2026-05-13T07:29:35+00:00

I am really stuck trying to implement RIA Services with MVVM and a crud

  • 0

I am really stuck trying to implement RIA Services with MVVM and a crud datagrid. I think i’m missing some key idea. All of the examples I have seen use a submit button or similar to send the data back to the client. I’d rather submit as soon as a row is added/deleted/modified. I thought of a couple of approaches:

  • Have my IEnuerable Itemsource property automatically bound to my context’s entitycontainer. I tried this but I cant set the context’s entities from the property.
  • Capture the row change events and manually tell my context that is has changed items. This doesnt feel right though in a MVVM design considering my Commodity property should reflect changes in the datagrid.

Additionally, how do I tell RIA Services what method it should be using for a particular crud operation? Does this happen on the client or server?

Note I am using the ComponentOne datagrid, though I dont think its behaviour would differ from the normal Silverlight datagrid for this simple example.

View:

<c1grid:C1DataGrid x:Name="C1Grid"                                    AutoGenerateColumns="False"
ItemsSource="{Binding Commodities}">
<c1grid:C1DataGrid.Columns>
<c1grid:DataGridTextColumn Binding="{Binding Name, Mode=TwoWay}"></c1grid:DataGridTextColumn> 
</c1grid:C1DataGrid.Columns>
</c1grid:C1DataGrid>

ViewModel:

public class CommodityViewModel : Model
    {
        private CommodityContext _context;
        private Commodity _selectedCommodity;

        public IEnumerable<Commodity> Commodities
        {
            get { return _context.Commodities;}
            //Setter wont work here

        }

        public CommodityViewModel()
        {

            _context = new CommodityContext();
            _context.Load(_context.GetCommoditiesQuery(), (LoadOperation<Commodity> loadOperation) =>
            {
                RaisePropertyChanged("Commodities");
                _context.Commodities.EntityAdded += Commodities_EntityAdded;

            }, null );

        }

        private void Commodities_EntityAdded(object sender, EntityCollectionChangedEventArgs<Commodity> e)
        {
            //how does RIA know to use my AddCommodity method on the server side? Where do I set this?
            _context.SubmitChanges();
        }



    }
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:29:36+00:00Added an answer on May 13, 2026 at 7:29 am

    Ok so perhaps my answer is only relevant to users of the C1 DataGrid – but they have implemented a special API for interacting with RIA Services. Details available here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Really stuck on trying to write code to unzip a file or directory on
I have a really simple request, but I'm stuck on how to implement the
I'm stuck in having to write a simple spam filter I'm not really sure
I am stuck! this seems really daft but I can not see where I
Really simple question - how do I do a search to find all records
I am stuck trying to figure out a way of checking if a user
I've found a similar question on stack overflow, but it didn't really answer the
Really my question has more to do with the server-side scrubbing of html that's
I really feel that I should learn Lisp and there are plenty of good
I really like DevX components, but they are pretty expensive, maybe anyone knows free

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.