发生System.Windows.Markup.XamlParseException. Microsoft Visual Studio社区2017 [英] System.Windows.Markup.XamlParseException occurred. Microsoft visual studio community 2017

查看:551
本文介绍了发生System.Windows.Markup.XamlParseException. Microsoft Visual Studio社区2017的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

H Guys

请有人帮忙.在尝试编译XAML代码时,我在下面遇到了此异常.

Please can someone be of help. I encountered this exception below, while trying to compile an XAML code.

发生System.Windows.Markup.XamlParseException
  HResult = 0x80131501
  Message =在'System.Windows.Baml2006.TypeConverterMarkupExtension'上提供值"引发了异常.行号"28"和行位置"22".
 来源= PresentationFramework
  StackTrace:
  在System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader,IXamlObjectWriterFactory writerFactory,布尔skipJournaledProperties,对象rootObject,XamlObjectWriterSettings设置,Uri baseUri)中
  在System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,布尔skipJournaledProperties,对象rootObject,XamlAccessLevel访问级别,Uri baseUri)
  在System.Windows.Markup.XamlReader.LoadBaml处(流流,ParserContext parserContext,对象父级,布尔型closeStream)
  在System.Windows.Application.LoadComponent(对象组件,Uri resourceLocator)中
  在c:\ users \ evanc \ documents \ Visual Studio 2017 \ Projects \ XAMLImage \ XAMLImage \ MainWindow.xaml:line 1
System.Windows.Markup.XamlParseException occurred
  HResult=0x80131501
  Message='Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '28' and line position '22'.
  Source=PresentationFramework
  StackTrace:
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at XAMLImage.MainWindow.InitializeComponent() in c:\users\evanc\documents\visual studio 2017\Projects\XAMLImage\XAMLImage\MainWindow.xaml:line 1

推荐答案

抱歉,我的回复很晚.

有时, 编译后,尽管会提示Visual Studio找不到资源,但Visual Studio仍会正确找到图像资源.在这种情况下,只需编译代码以查看是否 加载 图像资源 .

Sometimes, Visual Studio will find the image resources correctly after compilation, although Visual Studio will be prompted to find no resources. In this case, just compile your code to see whether load the image resources.

请注意,图像构建操作是资源.

Note that image Build Action is Resource .

然后尝试:

Then try:

  <Image Source="pack://application:,,,/wpfAppDemo;component/Images/Resource_Image.png" />

或者:

 <Image Source="/wpfAppDemo;component/Images/Resource_Image.png" />

或:

<Image Source="Images/Resource_Image.png" />

请注意,t 文件夹的结构.

Note that the structure of the folder.

最好的问候,

Bob

Bob


这篇关于发生System.Windows.Markup.XamlParseException. Microsoft Visual Studio社区2017的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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