Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/58.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# KeyValuePair<;双倍,双倍>;还有一份清单_C#_Charts - Fatal编程技术网

C# KeyValuePair<;双倍,双倍>;还有一份清单

C# KeyValuePair<;双倍,双倍>;还有一份清单,c#,charts,C#,Charts,我必须显示一个包含4个系列的图表。我可以用我的数据来做这件事。 但是,当我开始更新数据列表时,它会给出一个解析错误(见下文)。也就是说,在尝试“更新”图表之前,它会给我一个错误。见鬼,我甚至从等式中删除了图表,但仍然得到相同的解析错误 以下是我的列表的声明方式: public partial class MainWindow : Window { List<KeyValuePair<double, double>> channel1List = new List&

我必须显示一个包含4个系列的图表。我可以用我的数据来做这件事。 但是,当我开始更新数据列表时,它会给出一个解析错误(见下文)。也就是说,在尝试“更新”图表之前,它会给我一个错误。见鬼,我甚至从等式中删除了图表,但仍然得到相同的解析错误

以下是我的列表的声明方式:

public partial class MainWindow : Window
    {
List<KeyValuePair<double, double>> channel1List = new List<KeyValuePair<double, double>>();
        List<KeyValuePair<double, double>> channel2List = new List<KeyValuePair<double, double>>();
        List<KeyValuePair<double, double>> channel3List = new List<KeyValuePair<double, double>>();
        List<KeyValuePair<double, double>> channel4List = new List<KeyValuePair<double, double>>();
        List<List<KeyValuePair<double, double>>> rampsList = new List<List<KeyValuePair<double, double>>>();
公共部分类主窗口:窗口
{
List channel1List=新列表();
List channel2List=新列表();
List channel3List=新列表();
List channel4List=新列表();
List rampsList=新列表();
在我看来,我有:

 // DEFAULT CHANNEL 1 LIST
            channel1List.Add(new KeyValuePair<double, double>(0, 0));
            channel1List.Add(new KeyValuePair<double, double>(DMIN1, 0));
            channel1List.Add(new KeyValuePair<double, double>(DMAX1, 100));
            channel1List.Add(new KeyValuePair<double, double>(30, 100));
            // DEFAULT CHANNEL 2 LIST
            channel2List.Add(new KeyValuePair<double, double>(0, 0));
            channel2List.Add(new KeyValuePair<double, double>(DMIN2, 0));
            channel2List.Add(new KeyValuePair<double, double>(DMAX2, 100));
            channel2List.Add(new KeyValuePair<double, double>(30, 100));
            // DEFAULT CHANNEL 3 LIST
            channel3List.Add(new KeyValuePair<double, double>(0, 0));
            channel3List.Add(new KeyValuePair<double, double>(DMIN3, 0));
            channel3List.Add(new KeyValuePair<double, double>(DMAX3, 100));
            channel3List.Add(new KeyValuePair<double, double>(30, 100));
            // DEFAULT CHANNEL 4 LIST
            channel4List.Add(new KeyValuePair<double, double>(0, 0));
            channel4List.Add(new KeyValuePair<double, double>(DMIN4, 0));
            channel4List.Add(new KeyValuePair<double, double>(DMAX4, 100));
            channel4List.Add(new KeyValuePair<double, double>(30, 100));


            channel1List.RemoveAt(1);
            channel1List.Insert(1, new KeyValuePair<double, double>(DMIN1, 0));


            // DEFAULT LIST OF RAMPS
            rampsList.Add(channel1List);
            rampsList.Add(channel2List);
            rampsList.Add(channel3List);
            rampsList.Add(channel4List);
            // DRAW DEFAULT CHART
            rampsChart.DataContext = rampsList;
//默认频道1列表
channel1List.Add(新的键值对(0,0));
channel1List.Add(新的键值对(DMIN1,0));
channel1List.Add(新的键值对(dmax100));
channel1List.Add(新的键值对(30100));
//默认频道2列表
channel2List.Add(新的KeyValuePair(0,0));
channel2List.Add(新的键值对(DMIN2,0));
channel2List.Add(新的KeyValuePair(dmax2100));
channel2List.Add(新的KeyValuePair(30100));
//默认频道3列表
channel3List.Add(新的KeyValuePair(0,0));
channel3List.Add(新的KeyValuePair(DMIN3,0));
channel3List.Add(新的KeyValuePair(dmax3100));
channel3List.Add(新的KeyValuePair(30100));
//默认频道4列表
channel4List.Add(新的KeyValuePair(0,0));
channel4List.Add(新的KeyValuePair(DMIN4,0));
channel4List.Add(新的KeyValuePair(dmax4100));
channel4List.Add(新的KeyValuePair(30100));
通道1列表移除(1);
channel1List.Insert(1,新的键值对(DMIN1,0));
//坡道的默认列表
rampsList.Add(通道1列表);
rampsList.Add(channel2List);
rampsList.Add(信道3列表);
rampsList.Add(channel4List);
//绘制默认图表
rampshart.DataContext=rampsList;
注意到两行“channel1.RemoveAt(1)…....” 这些只是为了测试,我能够删除一个条目并用一个新条目替换它。 这些系列每个只有4个点,我总是只需要更新项目1和2。0和3永远不会更新

不管怎样,上面的代码工作正常。它绘制图表。没有解析错误

现在,就像我说的,当用户移动滑块时,我需要绘制这个图表。我为这个滑块设置了一个ValueChanged事件集,它可以很好地更新几个标签

但如果我有同样的两行:

channel1List.RemoveAt(1);
channel1List.Insert(1, new KeyValuePair<double, double>(DMIN1, 0));
channel1List.RemoveAt(1);
channel1List.Insert(1,新的键值对(DMIN1,0));
然后它给我没有错误时,建设项目,但给我这个错误时,我点击开始

PresentationFramework.dll中发生类型为“System.Windows.Markup.XamlParseException”的未处理异常

我不知道它为什么这样做

有什么想法吗? 谢谢 史蒂夫

编辑:完成堆栈:

'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'Z:\Temperature Controller\Software\C#\SWFT Imperium (WPF)\SWFT Imperium\SWFT Imperium\bin\Debug\SWFT Imperium.vshost.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. The thread 0x2d84 has exited with code 259 (0x103). The thread 0x2ae0 has exited with code 259 (0x103). 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'Z:\Temperature Controller\Software\C#\SWFT Imperium (WPF)\SWFT Imperium\SWFT Imperium\bin\Debug\SWFT Imperium.exe'. Symbols loaded. Step into: Stepping over non-user code 'SWFT_Imperium.App..ctor' 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Step into: Stepping over non-user code 'SWFT_Imperium.App.Main' Step into: Stepping over non-user code 'SWFT_Imperium.App.InitializeComponent' 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'Z:\Temperature Controller\Software\C#\SWFT Imperium (WPF)\SWFT Imperium\SWFT Imperium\bin\Debug\System.Windows.Controls.DataVisualization.Toolkit.dll'. Symbols loaded. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationUI\v4.0_4.0.0.0__31bf3856ad364e35\PresentationUI.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'SWFT Imperium.vshost.exe' (CLR v4.0.30319: SWFT Imperium.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'The invocation of the constructor on type 'SWFT_Imperium.MainWindow' that matches the specified binding constraints threw an exception.' Line number '4' and line position '9'. “SWFT Imperium.vshost.exe”(CLR v4.0.30319:SWFT Imperium.vshost.exe):加载了“C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0_B77A5C561934; E089\mscorlib.dll”。跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT Imperium.vshost.exe”(CLR v4.0.30319:SWFT Imperium.vshost.exe):加载了“C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\12.0.0.0_b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll”。跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):加载了“C:\Windows\Microsoft.Net\assembly\GACmsil\System.Windows.Forms\v4.0_4.0.0.0_uB77A5C561934; E089\System.Windows.Forms.dll”。跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):加载了“C:\Windows\Microsoft.Net\assembly\GAC\MSIL\System.Drawing\v4.0.0.0\UUU b03f5f7f11d50a3a\System.Drawing.dll”。跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):加载了“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0_B77A5C561934; E089\System.dll”。跳过了加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):已加载“C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\12.0.0.0_uuB03F5F7F11D50A3A\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll”。已跳过加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):已加载“C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0_uB03F5F7F11D50A3A\Microsoft.VisualStudio.Debugger.Runtime.dll”。已跳过加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):已加载“Z:\Temperature Controller\Software\C#\SWFT-Imperium(WPF)\SWFT-Imperium\SWFT-Imperium\bin\Debug\SWFT-Imperium.vshost.exe”。已跳过加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):加载了“C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0_B77A5C561934; E089\System.Data.dll”。跳过加载符号。模块已优化,调试器选项“仅我的代码”已启用。 “SWFT-Imperium.vshost.exe”(CLR v4.0.30319:SWFT-Imperium.vshost.exe):已加载“C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0.0.0__b77a5c5”
<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" x:Class="Swiftech_Imperium.MainWindow"
        Title="SWFT Imperium" Height="435" Width="510" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Icon="Swiftech.ico" Closing="Window_Closing" MouseDown="Grid_MouseDown" WindowStyle="None" BorderThickness="1" BorderBrush="Black" Foreground="Black">
    <Window.Resources>