VS2015: WPF Designer cannot locate resource which can be found at runtime and design time RRS feed

  • Question

  • The WPF designer fails with "IOException cannot locate resource" which is a png file in the same project.
    The error happens when showing the main window.
    The image is loaded in a nested control via an attached property.
    If I put an Image control inside the nested control, loading the same resource with the same path, the resource loads properly and it shows in the image control but NOT in the main window.
    If I used an attached property to load the image in another user control, it doesn't show in the user control, and it crashes the WPF designer of the main window with the error above.
    It seems as if something in the WPF framework removes the first character of the path because the error message shows "a/b/file.png" instead of "/a/b/file.png" which is the path specified in the XAML.
    Friday, August 5, 2016 12:45 AM