Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WPF MVVM
I'm not even sure that this is possible, but I thought that it would be smart to ask if anyone has ever done it before
 
I'm writing an interface in WPF using MVVM where an end user will be updating data which is collected using different user controls. The goal is to save all of the updates at the same time with an update button on the main window.
 
Using a Mediator, I can collect all of the information from all of the controls and then retrieve it for the update, but what would simplify everything is to just take the type that provided all of the data and store updates to IT, and then retrieve it when it's time to move these updates to the database.
 
I can do THAT with a generic class, but then I have to store the initial class by name to the generic class. What I'd like to do is to store whatever class I decide to use to a generic list. I can envision it, but I've never constructed that sort of relationship before.
 
I'm I way out to lunch here or is this something someone has done?
Posted 19-Sep-12 4:22am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If I understand you right, then all you need to do is the properties of an object (in this case the ViewModel) using reflection. You can look at the following for direction:
http://stackoverflow.com/questions/3610891/c-sharp-copying-property-values-from-one-instance-to-another-different-classe[^]
  Permalink  
Comments
Bob Brady at 19-Sep-12 16:52pm
   
I saw that and I've been coding it today. However I was hoping for a better way
Clifford Nelson at 19-Sep-12 17:17pm
   
Create an infrastructure, and then you can post an article on Codeproject with the code. Then there will be something better.
Bob Brady at 20-Sep-12 8:51am
   
In fact, I completely believe that. Genius rises to a challenge, not a question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 210
1 Richard MacCutchan 100
2 kbrandwijk 90
3 ProgramFOX 80
4 Mukesh Bhagat 65
0 Sergey Alexandrovich Kryukov 9,050
1 OriginalGriff 8,151
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100