Click here to Skip to main content
11,642,855 members (72,907 online)
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 jyo.net 480
1 OriginalGriff 370
2 DamithSL 328
3 Sergey Alexandrovich Kryukov 270
4 CPallini 197
0 DamithSL 541
1 OriginalGriff 495
2 Mika Wendelius 469
3 Sergey Alexandrovich Kryukov 330
4 Afzaal Ahmad Zeeshan 324


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2015
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