我正在尝试在我的WPF应用程序中使用图标以及其他一些图片,但是从设计视图中得到错误提示,例如“path-x不是有效的资源或无法找到”,其中“path-x”是我正在尝试使用的任何图像的路径。
如果它能够在正确的位置查找,我猜它会找到它的;)
但是,之后,它决定不再给我那个错误。所以,我继续点击运行(F5),想要看到新的图标出现在标题栏中。结果遇到了这个问题:
"System.Windows.Markup.XamlParseException occurred Message='Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '5' and line position '50'.
Source=PresentationFramework
LineNumber=5 LinePosition=50
StackTrace: at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri) 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 One_Stop_Management.MainWindow.InitializeComponent() in c:\Users\Jason\Documents\Visual Studio 2010\Projects\One Stop Management\One Stop Management\MainWindow.xaml:line 1 at One_Stop_Management.MainWindow..ctor() in C:\Users\Jason\Documents\Visual Studio 2010\Projects\One Stop Management\One Stop Management\MainWindow.xaml.cs:line 25 InnerException: System.IO.IOException Message=Cannot locate resource 'images/favicon.ico'. Source=PresentationFramework StackTrace: at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access) at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access) at System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream() at System.IO.Packaging.PackWebResponse.GetResponseStream() at System.IO.Packaging.PackWebResponse.get_ContentType() at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle) at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache) at System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy) at System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) at System.Windows.Baml2006.TypeConverterMarkupExtension.ProvideValue(IServiceProvider serviceProvider) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider) InnerException: "
为什么这个东西对我很无礼?我只是想插入一张图片...
更新
这是当我在属性窗格中
<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">
最新更新
我甚至无法使用属性窗格添加图标,以下是它给我的错误信息。