UWPアプリケーションでLiveChartsライブラリを使用しようとしています。私はLiveChartsとLiveCharts.UwpをNuGet経由でインストールしました。私は、彼らの最初の例を再作成するために、LiveChartsのウェブサイトで提供手順に従ったが、私は常にXAMLファイルに次のエラーを取得:"CartesianChart"という名前が "using:LiveCharts.Uwp"という名前空間に存在しません
名を「たCartesianChartは、」使用」の名前空間に存在しません:LiveChartsを。 UWP "
タイプ 'CartesianChart'でプロパティ 'Series'が見つかりませんでした。
(添付の2つの図を参照)。以下は
私のMainPage.xamlをとMainPage.xaml.csのコードです:
MainPage.xamlを:
<Page
x:Class="LC2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:LC2"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lvc="using:LiveCharts.Uwp"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<lvc:CartesianChart Series="{Binding SeriesCollection}" />
</Grid>
</Page>
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Windows.UI.Xaml.Controls;
using LiveCharts;
using LiveCharts.Uwp;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace LC2
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Values = new ChartValues<double> { 3, 5, 7, 4 }
},
new BarSeries
{
Values = new ChartValues<decimal> { 5, 6, 2, 7 }
}
};
}
public SeriesCollection SeriesCollection { get; set; }
}
}