Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to save changes made to a datagrid in wpf.The data should be save in resx file ,if not any file ..but not to database.

regards
pavankumar
Posted

1 solution

How you bind data grid with data?

The idea is: you should not save any data from controls immediately to file. This design is hard to maintain. You need to have a separate data layer, whatever it is and bind it to you UI controls and save your data from you data layer, not from control. Even of you don't use data binding, it means you bind this control through "manual" code, the design should be the same: you populate data from data layer to view, editing of the view should invalidate data and synchronize it with data layer, changes in data layer should update the view. The closest architectural pattern for this approach is MVC.

I suggest you learn and analyze applicability of the following architectural patterns (http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)[^]):

MVVM — Model View View Model,
http://en.wikipedia.org/wiki/Model_View_ViewModel[^],

MVC — Model-View-Controller,
http://en.wikipedia.org/wiki/Model-view-controller[^]),

MVA — Model-View-Adapter,
http://en.wikipedia.org/wiki/Model–view–adapter[^],

MVP — Model-View-Presenter,
http://en.wikipedia.org/wiki/Model-view-presenter[^].
Pay attention for the motivation of those architectures. If you understand it, you would be able to create better design ideas.

—SA
 
Share this answer
 
Comments
pavankumar246 15-Jul-11 10:50am    
i am using concept of binding and datatable to load the data....

Thanks for reply...
regards pavankumar
Sergey Alexandrovich Kryukov 15-Jul-11 10:58am    
Very well; I've been expecting something like that. So, you need to write a file from database.
--SA
Espen Harlinn 15-Jul-11 10:51am    
Good points
Sergey Alexandrovich Kryukov 15-Jul-11 10:58am    
Thank you, Espen.
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900