将社区 UI 元素合并到 "Default" WPF 应用程序中

Incorporating Community UI Elements into "Default" WPF Apps

我正在尝试按照 https://lvcharts.net/App/examples/v1/wpf/Material%20Design 上的教程进行操作,以便我可以使用 "The Current Chart" 图表可视化机器上的 CPU 使用情况。

我在 Visual Studio Pro 2017 中创建了一个新的默认 WPF 应用程序。从那里,我用教程中的代码片段覆盖了 MainWindow.xaml 和代码隐藏的内容。但是,我还缺少其他先决条件步骤,因为我在 xaml 和引用缺少程序集引用的代码背后都有错误,例如:

来自 xaml:

<Style TargetType="lvc:LineSeries"

The name "LineSeries" does not exist in the namespace "clr-namepsace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"

来自代码隐藏:

using LiveCharts;

The type or namespace name "LiveCharts" could not be find (are you missing a using directive or an assembly reference?)

我对 WPF 开发并非完全没有经验,但我以前从未尝试过使用非标准元素。是否有我可以参考的一般指南来填补如何利用社区解决方案的空白?

您需要下载并引用 LiveCharts 程序集。最简单的方法是使用 NuGet.

SelectTools->NuGet Package Manager->Package Manager Console在Visual Studio和运行下面的命令在Package Manager Console:

Install-Package LiveCharts.Wpf

这将下载并引用您构建应用程序所需的程序集。