Hi,
I want to create a pie chart in windows phone 8 application but there is some error in my code kindly check my code and resolve my error. Error occurred in <local:Data>
Error description: Data does not exist in the namespace "clr-namespace:phonechart"
in Xaml:
<UserControl x:Class="phonechart.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:ig="clr-namespace:Infragistics.Controls.Charts;assembly=InfragisticsWP8.Controls.Charts.XamDataChart.v14.1" xmlns:local="clr-namespace:phonechart"mc:Ignorable="d"d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White"><Grid.Resources><local:Data x:Key="data" /></Grid.Resources>
<ig:ItemLegend x:Name="Legend"Grid.Row="1"VerticalAlignment="Top"HorizontalAlignment="Right" Margin="10"Padding="10,5,10,5"/>
<ig:XamPieChart Name="pieChart"Grid.Row="2"ItemsSource="{StaticResource data}"LabelMemberPath="Label"ValueMemberPath="Value"ToolTip="{}{Label}"Legend="{Binding ElementName=Legend}"/></Grid></UserControl>
in C#:
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Navigation;using Microsoft.Phone.Controls;using Microsoft.Phone.Shell;using phonechart.Resources;using Infragistics.Controls.Charts;using Infragistics.Collections;using System.ServiceModel;
namespace phonechart{public partial class MainPage : UserControl{public MainPage(){InitializeComponent();}}
public class DataItem{public string Label { get; set; }public double Value { get; set; }}
public class Data : ObservableCollection<DataItem>{public Data(){Add(new DataItem { Label = "Item 1", Value = 5 });Add(new DataItem { Label = "Item 2", Value = 6 });Add(new DataItem { Label = "Item 3", Value = 3 });Add(new DataItem { Label = "Item 4", Value = 7 });Add(new DataItem { Label = "Item 5", Value = 5 });}}}
Hello Aamir,
Were you able to resolve your issue?
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
This appears to be the same question posted on your thread http://ko.infragistics.com/community/forums/t/89275.aspx.
Please see my response on that thread and let me know if you have any questions.