无法将属性“Source”的字符串“pack://application:,,,/Microsoft.Windows.Design.Developer;component/Images/Fit_To_Window.png”转换为“System.Windows.Media.ImageSource”类型的对象。 位图颜色上下文无效。 标记文件“Microsoft.Windows.Design.Developer;component/themes/ZoomControl.xaml”中对象“ControlTemplate_11”处的错误。
在 System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
在 System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
在 System.Windows.Markup.XamlTypeMapper.ParseProperty(Object targetObject, Type propType, String propName, Object dpOrPiOrFi, ITypeDescriptorContext typeContext, ParserContext parserContext, String value, Int16 converterTypeId)
在 System.Windows.Markup.OptimizedTemplateContent.ParseDependencyProperty(String attribValue, Int16 attributeId, Int16 converterTypeId, DependencyProperty& dp, Object& propertyValue)
在 System.Windows.Markup.OptimizedTemplateContent.LookForShareableRecord(BamlRecord bamlRecord, DependencyProperty& dp, Object& dpValue)
在 System.Windows.Markup.OptimizedTemplateContent.ReadPotentiallyShareableRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.OptimizedTemplateContent.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.OptimizedTemplateContent.AddContentRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.TemplateBamlRecordReader.AddContentRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.TemplateBamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
在 System.Windows.Markup.TemplateTreeBuilderBamlTranslator.ParseFragment()
在 System.Windows.Markup.TreeBuilder.Parse()
在 System.Windows.Markup.XamlTemplateSerializer.ConvertBamlToObject(BamlRecordReader reader, BamlRecord bamlRecord, ParserContext context)
在 System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在 System.Windows.Markup.StyleBamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.StyleBamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
在 System.Windows.Markup.StyleTreeBuilderBamlTranslator.ParseFragment()
在 System.Windows.Markup.TreeBuilder.Parse()
在 System.Windows.Markup.XamlStyleSerializer.ConvertBamlToObject(BamlRecordReader reader, BamlRecord bamlRecord, ParserContext context)
在 System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
在 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
在 System.Windows.Markup.BamlRecordReader.ReadElement(Int64 startPosition, XamlObjectIds contextXamlObjectIds, Object dictionaryKey)
在 System.Windows.ResourceDictionary.CreateObject(Int32 valuePosition, Object key)
在 System.Windows.ResourceDictionary.RealizeDeferContent(Object key, Object& value, Boolean& canCache)
在 System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
在 System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
在 System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
在 System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
在 System.Windows.ResourceDictionary.get_Item(Object key)
在 System.Windows.DeferredResourceReference.GetValue(BaseValueSourceInternal valueSource)
在 System.Windows.DependencyPropertyChangedEventArgs.get_NewValue()
在 System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType)
在 System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
在 System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
在 System.Windows.StyleHelper.LoadOptimizedTemplateContent(DependencyObject container, ParserContext parserContext, OptimizedTemplateContent optimizedTemplateContent, FrameworkTemplate frameworkTemplate, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
在 System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
在 System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
在 System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
在 System.Windows.FrameworkElement.ApplyTemplate()
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Designer.Viewport.MeasureOverride(Size availableSize)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
在 System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Grid.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
在 System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Controls.Control.MeasureOverride(Size constraint)
在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
在 System.Windows.UIElement.Measure(Size availableSize)
在 System.Windows.Interop.HwndSource.SetLayoutSize()
在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
在 System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
在 MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize()
在 MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content)
在 MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle()
在 MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle()
在 MS.Internal.Designer.DesignerPane.LoadDesignerView()
位图颜色上下文无效。
在 MS.Internal.HRESULT.Check(Int32 hr)
在 System.Windows.Media.ColorContextHelper.OpenColorProfile(IntPtr pProfile)
在 System.Windows.Media.ColorContext.FromRawBytes(Byte[] data)
在 System.Windows.Media.ColorContext.FromStream(Stream stm, String filename)
在 System.Windows.Media.ColorContext.Initialize(Uri profileUri, Boolean isStandardProfileUriNotFromUser)
在 System.Windows.Media.ColorContext..ctor(PixelFormat pixelFormat)
在 System.Windows.Media.Imaging.BitmapSource.CreateCachedBitmap(BitmapFrame frame, BitmapSourceSafeMILHandle wicSource, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, BitmapPalette palette)
在 System.Windows.Media.Imaging.BitmapFrameDecode.FinalizeCreation()
在 System.Windows.Media.Imaging.BitmapFrameDecode..ctor(Int32 frameNumber, BitmapSourceSafeMILHandle sourceHandle, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, BitmapDecoder decoder)
在 System.Windows.Media.Imaging.BitmapDecoder.SetupFrames(BitmapDecoder decoder, ReadOnlyCollection`1 frames)
在 System.Windows.Media.Imaging.BitmapDecoder.get_Frames()
在 System.Windows.Media.Imaging.BitmapFrame.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy)
在 System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
在 System.ComponentModel.TypeConverter.ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, String text)
在 System.Windows.Markup.XamlTypeMapper.ParseProperty(Object targetObject, Type propType, String propName, Object dpOrPiOrFi, ITypeDescriptorContext typeContext, ParserContext parserContext, String value, Int16 converterTypeId)
文本内容中发现无效字符。
发现碰到这个错误的人很少,只有在VISTA才有的问题;
本文解决了一个在WPF应用程序中遇到的问题:无法将图片资源加载为ImageSource类型对象,尤其是在Vista系统中出现的位图颜色上下文无效错误。

263

被折叠的 条评论
为什么被折叠?



