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 mod开发者_开发百科el when press save button.
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
.
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.
精彩评论