Editing a xml file located project root on WP8



I want to change a value of an XML file which is located in project root folder.


Following code can read "isFirstUse" and changes the value "YES" to "NO".


I have a XML file named "Values.xml" in project root, however, I can't save changes on file.



public void writeFile()
{
XDocument xDoc = XDocument.Load("Values.xml");
lblSafakCount.Text = xDoc.Descendants("isFirstUse").FirstOrDefault().Value.ToString();

XElement xElm = xDoc.Descendants("isFirstUse").FirstOrDefault();
xElm.Value = "NO";
xElm.Save("Values.xml");
}


"xElm.Save("Values.xml")" code not saving, it requires stream or textwriter and denies string. How can I edit local(project root, not phone storage) XML file? Thanks.


No comments:

Post a Comment