Reputation: 51
I am new in wpf .i want to know how to insert data from views to XML using mvvm method. i am using xml as database.actually i want to know how data go to view model when press save button.
Upvotes: 0
Views: 430
Reputation: 19885
Your best bet is to use XmlDocument
type to load the Xml data and then bind it to DataGrid
's ItemsSource
property. Create columns based on xmlNode.Attributes
.
Upvotes: 2
Reputation: 30097
In MVVM
your current/present data always exist in ViewModel
, so there is no need to pass data to View Model
in order to save it. Your View
always shows/display data that exist in ViewModel
. So on Save
button click you should just save data in to XML
which already exist in ViewModel
most probably contained in some collection or other similar data structure.
Upvotes: 1