【问题标题】:using Extended WPF toolkit 2.0 in visual studio 2010 framework 4.0在 Visual Studio 2010 框架 4.0 中使用扩展的 WPF 工具包 2.0
【发布时间】:2013-09-26 12:38:42
【问题描述】:

我正在尝试在我的 WPF 应用程序中合并一个图表,但我无法构建,因为我收到错误 unknown build error, 'clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly= System.Windows.Controls.DataVisualization.Toolkit' mapping URI is not valid

我的 xaml 文件如下所示:

<Window x:Class="Report_Generator.MainWindow"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
        Title="Report Generator" Height="695" Width="961" WindowStyle="ThreeDBorderWindow">

我实现图表的位置如下:

<my:Chart  Name="ColumnChart1" Title="Total Marks" Margin="33,330,0,358" HorizontalAlignment="Left" Width="379">
    <my:AreaSeries DependentValuePath="Value"
                   IndependentValuePath="Key"
                   ItemsSource="{Binding ColoumnChart1}"
                   IsSelectionEnabled="True"/>
</my:Chart>`

和后面的代码:

    public MainWindow()
    {
        InitializeComponent();
        showColumnChart();
    }

    private void showColumnChart()
    {
        List<KeyValuePair<string, int>> MyValue = new List<KeyValuePair<string, int>>();
        MyValue.Add(new KeyValuePair<string, int>("Mahak", 300));
        MyValue.Add(new KeyValuePair<string, int>("Pihu", 250));
        MyValue.Add(new KeyValuePair<string, int>("Rahul", 289));
        MyValue.Add(new KeyValuePair<string, int>("Raj", 256));
        MyValue.Add(new KeyValuePair<string, int>("Vikas", 140));

        ColumnChart1.DataContext = MyValue;

    }

这是我尝试使用 wpftoolkit for framework 3.5 实现的示例代码,但由于错误而无法构建它。我猜这是由于框架差异,但现在我下载了扩展的 WPF 工具包 2.0,我认为它应该与 .NET 框架 4.0 一起运行。有没有人知道如何将扩展的 WPF 工具包 2.0 与 Visual stuio 2010 wpf 一起使用应用???另一个问题是我在ColumnChart1.DataContext = MyValue; 后面的代码中出现错误,说名称 ColoumnChart1 在当前上下文中不存在。

【问题讨论】:

    标签: c# .net wpf visual-studio-2010


    【解决方案1】:

    实际上我解决了这个问题。原来只有几个错误.. 在后面的代码中,我添加了这个语句并且所有的东西都起作用了:

    using System.Windows.Controls.DataVisualization.Charting;

    当然,我必须将参考添加到 wpftoolkit WPFToolkitSystem.Windows.Controls.DataVisualization.Toolkit

    【讨论】:

      猜你喜欢
      • 2011-10-10
      • 2011-05-08
      • 2011-09-10
      • 2012-11-06
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多