我想在我的WPF应用程序中使用图标,并为其他事物使用一些图标,但是我一直从设计器视图中收到错误,例如“path-x不是有效资源或无法找到。“ - 其中“path-x”是我尝试使用的任何图像的路径。使用WPF中的图像和图标
如果正在寻找在正确的地方,我敢打赌,它会发现它;)
,但随后,它决定给不给我这个错误了。所以,我继续点击Run(F5),在标题栏中看到我的新图标。只有与此兽对质:
“System.Windows.Markup.XamlParseException 发生消息= System.Windows.Baml2006.TypeConverterMarkupExtension‘上 提供价值' 引发了异常。’行号 '5' 和 线位置 '50'
源= PresentationFramework
LineNumber上= 5 LinePosition = 50
堆栈跟踪: 在System.Windows.Markup.XamlReader.RewrapException(例外 E,IXamlLineInfo lineInfo,乌里 基本URI) 在System.Windows.Markup.WpfXamlLoader.Load(xamlReader xamlReader,IXamlObjectWriterFactory writerFactory,布尔 skipJournaledProperties,对象 rootObject,XamlObjectWriterSettings 设置,乌里基本URI) 在System.Windows.Markup.WpfXamlLoader.L oadBaml(XamlReader xamlReader,布尔 skipJournaledProperties,对象 rootObject,XamlAccessLevel ACCESSLEVEL,乌里基本URI) 在System.Windows.Markup.XamlReader.LoadBaml(流 流,ParserContext parserContext, 对象的父,布尔closeStream) 在系统.Windows.Application.LoadComponent(对象 组件,乌里resourceLocator) 在One_Stop_Management.MainWindow.InitializeComponent() 在C:\用户\杰森\文档\ 2010的Visual Studio的 \项目\一站式 管理\一站式 管理\ MainWindow.xaml:第1行 在O C:\ Users \ Jason \ Documents \ Visual Studio 2010 \ Projects \ One Stop Management \ One Stop Management \ MainWindow.xaml.cs:line 25 InnerException:System.IO .IOException Message =找不到资源'images/favicon.ico'。 源= PresentationFramework 堆栈跟踪: 在MS.Internal.AppModel.ResourcePart.GetStreamCore(的FileMode 模式,FileAccess的访问) 在System.IO.Packaging.PackagePart.GetStream(的FileMode 模式,FileAccess的访问) 在System.IO .Packaging.PackWebResponse.CachedResponse.GetResponseStream() 在System.IO.Packaging.PackWebResponse.GetResponseStream() 在System.IO.Packaging.PackWebResponse.get_ContentType() 在System.Windows.Media.Imaging.BitmapDecoder。SetupDecoderFromUriOrStream(URI URI,流流,BitmapCacheOption cacheOption,的Guid & CLSID,布尔& isOriginalWritable,流& uriStream, UnmanagedMemoryStream & unmanagedMemoryStream,SafeFileHandle & safeFilehandle) 在System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream (Uri baseUri,Uri uri,Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCa CHE) 在System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(URI 基本URI,URI的Uri,流流, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy) 在System.Windows.Media.ImageSourceConverter.ConvertFrom( ITypeDescriptorContext 方面,CultureInfo的文化,对象 值) 在System.Windows.Baml2006.TypeConverterMarkupExtension.ProvideValue(IServiceProvider的 的ServiceProvider) 在MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(的MarkupExtension 我的IServiceProvider的ServiceProvider) 的InnerException :“
为什么这件事情给我的态度?我只是想插入图片...
更新
下面是制作的图标,当我试图使用添加图标的属性面板的XAML:
<Fluent:RibbonWindow x:Class="One_Stop_Management.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
Title="One Stop Management" Height="727" Width="1208" Icon="Resources\favicon.ico">
最新
我甚至不能添加使用属性窗格中的图标,下面是它给我的错误。
你可以分享试图插入图像的XAML吗? – 2011-04-08 23:47:17
是的。我现在正在更新。 – 2011-04-08 23:57:35
@Craig,将其添加到问题的底部。谢谢。 – 2011-04-08 23:59:22