Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# winRT XAML工具包数据可视化Windows Phone 8.1_C#_Xaml_Windows Phone 8.1_Winrt Xaml Toolkit - Fatal编程技术网

C# winRT XAML工具包数据可视化Windows Phone 8.1

C# winRT XAML工具包数据可视化Windows Phone 8.1,c#,xaml,windows-phone-8.1,winrt-xaml-toolkit,C#,Xaml,Windows Phone 8.1,Winrt Xaml Toolkit,我尝试实现WinRT XAML工具包数据可视化 我有一个分组的数据列表 ObservableCollection<Notes> items = await App.DataModel.GetNotes(); var groupedData = (from data in items group data by data.Title into g orderb

我尝试实现WinRT XAML工具包数据可视化 我有一个分组的数据列表

 ObservableCollection<Notes> items = await App.DataModel.GetNotes();

        var groupedData = (from data in items
                           group data by data.Title into g
                           orderby g.Key
                           select new Group<string, Notes>
                           {
                               Key = g.Key.ToString(),
                               Items = g.ToList()
                           }).ToList();

        List<GroupedDataType> groupedList2 = new List<GroupedDataType>();

        foreach (var item in groupedData)
        {
            int results = 0;
            foreach (var rslt in item.Items)
            {
                results += rslt.Result;
            }

            groupedList2.Add(new GroupedDataType(results, item.Items[0].Title));
        }
        PieChart.ItemsSource= groupedList2; 
XAML代码:

 <Charting:PieSeries x:Name="PieChart"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     IndependentValueBinding="{Binding Type}"
                     DependentValueBinding="{Binding TotalResult}">
                </Charting:PieSeries>

但它没有显示任何图表,请帮助我知道我的代码是否有问题


谢谢。

我没有使用PieCharts,但通常您绑定到一个集合
ItemsSource=“{Binding groupedList2}”

您应该对xaml实现一个命令来告诉它重新渲染

public class YourClass : INotifyPropertyChanged

同样,我还没有使用饼图

Hello Barn,谢谢你的帮助,我尝试实现这一点,它在调试时工作,但当我发布时,我无法导航到该页面,它说:pieseries无法添加到collection1类型的集合/字典中
<Charting:Chart x:Name="MyPie" Title="Results" Width="400" > 
        <Charting:PieSeries ItemsSource="{Binding groupedList2}" IndependentValuePath="Type"
            DependentValuePath="TotalResult"> 
        </Charting:PieSeries> 
</Charting:Chart>
PieChart.ItemsSource= groupedList2;
public class YourClass : INotifyPropertyChanged