Windows手机应用程序 [英] Windows phone application
本文介绍了Windows手机应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我创建一个Windows Phone应用程序。我有一个文本框我想把文件从xml文件中删除。我有一个错误,无法转换systemCollectionGenric en String如何才能解决这个问题
这是我的文本框定义到XAML。
< textbox x:name =Nomwidth =371margin =0,496,0,0height =90verticalalignment =热门xmlns:x =#unknown>
和我的xml文件
Hello
I create a windows phone application.i have a textbox i want to put the text from xml file.Ihave an error cant convert systemCollectionGenric en String how cani solve this thanks
this is my textbox definition en XAML.
<textbox x:name="Nom" width="371" margin="0,496,0,0" height="90" verticalalignment="Top" xmlns:x="#unknown">
and this my xml file
<Chart>
<chart>SerialChart</chart>
<title>Title</title>
<CategoryValueMemberPath>month</CategoryValueMemberPath>
<AxisForeground>White</AxisForeground>
<PlotAreaBackground>Black</PlotAreaBackground>
<GridStroke>Green</GridStroke>
<Graph>Line</Graph>
<Title>Title</Title>
<ValueMemberPath>actual</ValueMemberPath>
<Brush>green</Brush>
<Brush>red</Brush>
</Chart>
这是我的代码背后
this is my code behind
InitializeComponent();
XDocument loadedData = XDocument.Load("XML.xml");
var data = from query in loadedData.Descendants("Chart")
select new Person
{
FirstName = (string)query.Element("title"),
LastName = (string)query.Element("Graph"),
Age = (int)query.Element("StrokeThickness")
};
Nom.Text = data;
推荐答案
你好,
它应该在查询结果的Value属性中使用,而不是将查询字符串值转换为整数
Hello,
It should be used in the Value property of the query result, instead regarding the query string value is converted to an integer
InitializeComponent();
XDocument loadedData = XDocument.Load("XML.xml");
var data = from query in loadedData.Descendants("Chart")
select new Person
{
FirstName = query.Element("title").Value,
LastName = query.Element("Graph").Value,
Age = Int.Parse(query.Element("StrokeThickness").Value)
};
Nom.Text = data;
再见。
Bye.
这篇关于Windows手机应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文