βӔḺ*_*ⱫŌŔ 10 .net c# wpf icons image
我试图在我的WPF应用程序中使用一个Icon,并在其他方面使用一些图像,但我不断从Designer视图中收到错误,例如"path-x不是有效资源或无法找到". - 其中"path-x"是我尝试使用的任何图像的路径.
如果它在正确的地方寻找,我打赌它会找到它;)
然后,它决定不再给我那个错误了.所以,我继续点击Run(F5),在标题栏中看到我的新图标.只有面对这头野兽:
"System.Windows.Markup.XamlParseException发生Message ='在'System.Windows.Baml2006.TypeConverterMarkupExtension'上提供值引发异常." 行号'5'和行位置' 50'.Source
= PresentationFramework
LineNumber = 5 LinePosition = 50
StackTrace:在System.Windows.Markup的System.Windows.Markup.XamlReader.RewrapException(Exception e,IXamlLineInfo lineInfo,Uri baseUri)中. System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader,Boolean skipJournaledProperties,Object rootObject,XamlAccessLevel accessLevel,Uri baseUri)中的WpfXamlLoader.Load(XamlReader xamlReader,IXamlObjectWriterFactory writerFactory,Boolean skipJournaledProperties,Object rootObject,XamlObjectWriterSettings设置,Uri baseUri) .Windows.Markup.XamlReader.LoadBaml(Stream stream,ParserContext parserContext,Object parent,Boolean closeStream)位于System.Windows.Application.LoadComponent(对象组件,Uri resourceLocator),位于c:\ Users \中的One_Stop_Management.MainWindow.InitializeComponent() Jason\Documents\Visual Studio 2010\Projects\One Stop Management\One Stop Management\MainWindow.xaml:One_Stop_Management.MainWindow第1行 C:\ Users\Jason\Documents\Visual Studio 2010\Projects\One Stop Management\One Stop Management\MainWindow.xaml.cs中的..ctor():第25行InnerException:System.IO.IOException消息=找不到资源'图像/ favicon.ico的".Source = PresentationFramework StackTrace:位于System.IO.Packaging.PackWebResponse.CachedResponse的System.IO.Packaging.PackagePart.GetStream(FileMode模式,FileAccess访问)的MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode模式,FileAccess访问). System.IO.Packaging.PackWeb上的System.IO.Packaging.PackWebResponse.GetResponseStream()处的System.IO.Packaging.PackWebResponse.GetResponseStream()中的GetResponseStream().事件处理器.调整解决方法.Uri uri,流,BitmapCacheOption cacheOption,Guid&系统中的System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri,Uri uri,Stream stream,BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,RequestCachePolicy uriCachePolicy,Boolean insertInDecoderCache)中的clsId,Boolean&isOriginalWritable,Stream&uriStream,UnmanagedMemoryStream&unmanagedMemoryStream,SafeFileHandle&safeFilehandle) .Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri,Uri uri,Stream stream ,位于MS.Internal.Xaml的System.Windows.Baml2006.TypeConverterMarkupExtension.ProvideValue(IServiceProvider serviceProvider)的System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,Object value)中的BitmapCreateOptions createOptions,BitmapCacheOption cacheOption,RequestCachePolicy uriCachePolicy) .Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me,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">
Run Code Online (Sandbox Code Playgroud)

我甚至无法使用属性窗格添加图标,下面是它给我的错误.
确保目标是资源.然后做这样的事情:
Icon="/MobilWPF;component/Resources/Images/MobileIcon.ico"
Run Code Online (Sandbox Code Playgroud)
MobilWPF是你的命名空间,或者你是项目名称?我忘记了我的项目名称和命名空间是一样的.
很抱歉我无法提供更多帮助。起初阅读您的问题时,我认为这只是类型不匹配,就像您在指定字符串时指定了一个图像一样。这个问题似乎有多种可能的解决方案。我不会将它们全部列出,而是将您链接到包含它们的 Microsoft Connect 页面。
| 归档时间: |
|
| 查看次数: |
21789 次 |
| 最近记录: |