XamlParseException是未处理的错误 [英] XamlParseException was unhandled error

查看:466
本文介绍了XamlParseException是未处理的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该错误的解决方案是什么?

 System.IO.FileNotFoundException
无法加载文件或程序集'System.Windows,版本= 2.0.5.0,区域性=中性,PublicKeyToken = 7cec85d7bea7798e'或其依赖项之一.该系统找不到指定的文件

未处理System.Windows.Markup.XamlParseException
  Message ='对与指定绑定约束匹配的类型'WpfApplication1.MainWindow'的构造函数的调用引发了异常.行号"5"和行位置"9".
  来源= PresentationFramework
  LineNumber = 5
  LinePosition = 9
  堆栈跟踪:
       在System.Windows.Markup.XamlReader.RewrapException(Exception e,IXamlLineInfo lineInfo,Uri baseUri)

.------------------------- --------------------------

 <   Window     x:Class   ="  
 
                     span>    xmlns   ="  http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                     span>    xmlns:x   ="  http://schemas.microsoft.com/winfx/2006/xaml" 
                   span>    xmlns:local   ="  clr-namespace:WpfApplication1" 
                     span>    xmlns:sys   ="  clr-namespace:System; assembly = mscorlib" 
                   span>    xmlns:chartingToolkit   ="  clr命名空间:System.Windows.Controls.DataVisualization.Charting; assembly = System.Windows.Controls.DataVisualization.Toolkit" 
                     span>   标题  =" 水力计算,2011"  ResizeMode    CanMinimize" 
                     span>    WindowStartupLocation   ="  CenterScreen" 图标  /WpfApplication1; component/Images/2.ico"  WindowStyle   ="  已加载   Window_Loaded "  mc:Ignorable   ="     xmlns:d   ="  http://schemas.microsoft.com/expression/blend/2008"  xmlns:mc    http://schemas.openxmlformats.org/markup-compatibility/2006 "  d:DesignHeight    534"  d:DesignWidth   ="     ="   > 

    <   Window.TaskbarItemInfo  > 
        <   TaskbarItemInfo    > 
    <  /Window.TaskbarItemInfo  > 
    <  网格    ="   497" <   chartingToolkit:图表    Grid.Column   ="     Grid.ColumnSpan   ="     Grid.Row   ="     Grid.RowSpan   ="    高度  ="  
 
                     span>                                        Horizo​​ntalAlignment   左"    保证金  ="  53,3,0,0" 名称  ="    垂直对齐  ="  宽度  ="  
                     span>                                        BorderBrush    DarkMagenta"  > 
                        <   chartingToolkit:PieSeries     ItemsSource   ="  
 
                     span>                                                      ="   {Binding Path = Name}" 
                     span>                                                      ="   {Binding Path = Votes}" <  /chartingToolkit:PieSeries  > 
                    <  /chartingToolkit:图表 > 
<  /Grid  > 
    <   Window.Background  > 
        <   LinearGradientBrush     ="   1,0.5"  StartPoint    0 ,0.5" <   GradientStop     ="  黑色" 偏移量  > 0"    / > 
            <   GradientStop     ="  #FF2C83CB" 偏移量   1"   / > 
        <  /LinearGradientBrush  > 
    <  /Window.Background  > 
<  /Window  >  

解决方案

主窗口的XAML中存在某种绑定错误.您能否显示XAML代码-使用改进问题"按钮将其添加到原始问题中.


''The invocation of the constructor on type ''WpfApplication1.MainWindow'' that matches the specified binding constraints threw an exception.'' Line number ''10'' and line position ''9''

.


public partial class Window1 : System.Windows.Window { public Window1() { try { InitializeComponent(); } catch ( Exception ex ) { // Log error (including InnerExceptions!) // Handle exception } } }


Hi, what''s solution for this error?

System.IO.FileNotFoundException
Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified

System.Windows.Markup.XamlParseException was unhandled
  Message='The invocation of the constructor on type 'WpfApplication1.MainWindow' that matches the specified binding constraints threw an exception.' Line number '5' and line position '9'.
  Source=PresentationFramework
  LineNumber=5
  LinePosition=9
  StackTrace:
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)

.---------------------------------------------------

<Window x:Class="WpfApplication1.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:local="clr-namespace:WpfApplication1"

        xmlns:sys="clr-namespace:System;assembly=mscorlib"

        xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"

        Title="Hydraulic Calculations, 2011" ResizeMode="CanMinimize"

        WindowStartupLocation="CenterScreen" Icon="/WpfApplication1;component/Images/2.ico" WindowStyle="SingleBorderWindow" Loaded="Window_Loaded" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="534" d:DesignWidth="780" SizeToContent="WidthAndHeight">

    <Window.TaskbarItemInfo>
        <TaskbarItemInfo />
    </Window.TaskbarItemInfo>
    <Grid Height="497">
<chartingToolkit:Chart Grid.Column="6" Grid.ColumnSpan="7" Grid.Row="14" Grid.RowSpan="7" Height="126"

                               HorizontalAlignment="Left" Margin="53,3,0,0" Name="chart1" VerticalAlignment="Top" Width="316"

                               BorderBrush="DarkMagenta">
                        <chartingToolkit:PieSeries ItemsSource="{Binding}"

                                       IndependentValueBinding="{Binding Path=Name}"

                                       DependentValueBinding="{Binding Path=Votes}">

                        </chartingToolkit:PieSeries>
                    </chartingToolkit:Chart>
</Grid>
    <Window.Background>
        <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
            <GradientStop Color="Black" Offset="0" />
            <GradientStop Color="#FF2C83CB" Offset="1" />
        </LinearGradientBrush>
    </Window.Background>
</Window>

解决方案

There is some sort of binding error in the XAML for your Main Window. Can you show you XAML code - add it to your original question using Improve Question button.


''The invocation of the constructor on type ''WpfApplication1.MainWindow'' that matches the specified binding constraints threw an exception.'' Line number ''10'' and line position ''9''

.


public partial class Window1 : System.Windows.Window { public Window1() { try { InitializeComponent(); } catch ( Exception ex ) { // Log error (including InnerExceptions!) // Handle exception } } }


这篇关于XamlParseException是未处理的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆