Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
WPF Gotcha: Cannot locate Resource "FileName.xaml"

Today I was working with a WPF project and when I went to run the application I got the following error 'Cannot locate resource 'FileName.xaml'.  Note, this is NOT a compiler error, this is a runtime error.

When I opened up the App.xaml file, the StartupUri appeared to be correct, but I would still get this error.  After playing around for a few minutes it dawned on me what the issue is.

Let me explain:

In my project I created a subfolder to put my views (forms) into.  I named this folder 'Views'.  Example:
-> Root
     -> Views
          -> FileName.xaml

Turns out that in order for the StartupUri to find the xaml form, you need to provide the file path of the file, not name the namespace path of the file.  When I did that it all worked.

None Working StartupUri
StartupUri="FileName.xaml"

Working StartupUri
StartupUri="Views/LayoutEditor.xaml"

Hope this helps

Till next time


kick it on DotNetKicks.com
Posted 08-05-2007 9:56 AM by Derik Whittaker
Filed under: , , ,

[Advertisement]

Comments

Cornel wrote re: WPF Gotcha: Cannot locate Resource "FileName.xaml"
on 05-02-2008 9:29 AM

Helped. Thanks a lot

jcvasquezt wrote re: WPF Gotcha: Cannot locate Resource "FileName.xaml"
on 06-04-2008 6:19 PM

dude, you rock I've been looking for this for a while.

thanks a lot.

Suraj Mehare wrote re: WPF Gotcha: Cannot locate Resource "FileName.xaml"
on 11-13-2008 6:58 AM

your suggestion helped me solve the exact problem, thanks a lot

Tomi wrote re: WPF Gotcha: Cannot locate Resource "FileName.xaml"
on 04-28-2009 3:45 PM

Helped to me, too. Thank you! Have a nice day!

Roel wrote re: WPF Gotcha: Cannot locate Resource "FileName.xaml"
on 06-18-2009 9:32 AM

Thanks! Just what i was looking for!

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)