title: Using Images and Icons in WPF
body: <p>I am trying to use an Icon in my WPF application, and some images for other things, but I keep getting errors from the Designer View saying stuff like "path-x is not a valid resource or cannot be found." - where "path-x" is the path of whatever image I am trying to use.</p>
  
  <p>If it were looking in the right place, I bet it'd find it ;)</p>
  
  <p>BUT, then, it decided to not give me that error anymore. So, I went ahead and clicked Run (F5), to see my new Icon in the title bar. Only to be confronted with this beast:</p>
  
  <blockquote>
    <p>"System.Windows.Markup.XamlParseException
    occurred   Message='Provide value on
    'System.Windows.Baml2006.TypeConverterMarkupExtension'
    threw an exception.' Line number '5'
    and line position '50'.<br>
    Source=PresentationFramework<br>
    LineNumber=5   LinePosition=50<br>
    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&amp; clsId, Boolean&amp;
    isOriginalWritable, Stream&amp; uriStream,
    UnmanagedMemoryStream&amp;
    unmanagedMemoryStream, SafeFileHandle&amp;
    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:  "</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/9OodS.png" alt="Exception at runtime while trying to use an icon for my titlebar!"></p>
  
  <p>Why is this thing giving me attitude? I'm just trying to insert an image...</p>
  
  <h1> Updates</h1>
  
  <p>Here is the XAML that was produced for the icon when I tried to add the Icon using the Properties Pane:</p>
  
  <pre><code>&lt;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"&gt;
  </code></pre>
  
  <h1>Latest Update</h1>
  
  <p><img src="https://i.stack.imgur.com/cGGRP.png" alt="enter image description here"></p>
  
  <p>I can't even add an icon using the properties pane, below is the error it gives me.</p>