Hi,
thanks for giving the reply,I am not using MVVM,
I wrote the code as follows,
class:
public class Chart
{
#region Properties
public string name { get; set; }
public int marks { get; set; }
#endregion
#region Constructors
public Chart(string Name, int Marks)
{
name = Name;
marks = Marks;
}
#endregion
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
loginid = StudentPerformance.loginId;
examname = StudentPerformance.examname;
examtypeid = StudentPerformance.examtypeid;
client.GetStudentPerformanceChartCompleted+=new EventHandler<GetStudentPerformanceChartCompletedEventArgs>(client_GetStudentPerformanceChartCompleted);
client.GetStudentPerformanceChartAsync(loginid, examname, examtypeid);
}
private void client_GetStudentPerformanceChartCompleted(object sender,ServiceReference1.GetStudentPerformanceChartCompletedEventArgs e)
{
XElement xmlNews = XElement.Parse(e.Result.ToString());
var results = from item in xmlNews.Descendants("SyllabusDetails")
select new Chart((string)item.Element("SubjectName"),
(int)item.Element("ResultedMarks"));
// BarSeries a = new BarSeries();//when I using this ?I got empty chart
//a.ItemsSource = results;
}
XAML:
<charting:Chart Foreground="Blue" x:Name="seriesChart" Background="Black">
<charting:BarSeries Name="BarChart" ItemsSource="{StaticResource result}" DependentValuePath="marks" IndependentValuePath="name" Foreground="Pink" Background="Black" />
</charting:Chart>
and I got an error in xaml as the resource result could not be resolved.
Srujana, if this helps please login to Mark As Answer. |
Reply | Alert Moderator