我在Windows商店中创建一个应用程序,并在创建的xml文件中写入xml时遇到问题.我在Windows应用商店应用中遵循了这个编辑XML文件,但它对我不起作用.
我想在按钮点击时在我的xml文件中写入这个xml.
这个东西的任何替代方式..
ck.png COKE (1793-1844)
我当前的文件是这样的:
** pepsi.png PEPSI (1793-1844) **
这是我尝试过的:
namespace DrinksApp { ////// An empty page that can be used on its own or navigated to within a Frame. /// public sealed partial class coke : Page { public coke() { this.InitializeComponent(); } XmlDocument dom = new XmlDocument(); private void Button_Click(object sender, RoutedEventArgs e) { this.Frame.Navigate(typeof(softdrinks)); } private async void Button_Click_1(object sender, RoutedEventArgs e) { XDocument xmlDoc = XDocument.Load("favourite//fav.xml"); xmlDoc.Root.Add(new XElement("drink", new XAttribute("drinkImage","ck.png"), new XAttribute("drinkTitle","PEPSI"), new XAttribute("drinkDescription","NONE") )); xmlDoc.Save(xmlDoc); **//This isn't working in windows store ..** } } } }
我已经有一个如上所述的xml文件: