Renaming WPF Windows
So, I wanted to rename a window in a WPF application - a prototype I'm working on.
First, I rename the code in the .cs code-behind file. Then, I change the Class attribute on the root element of the xaml file.
Cool, thinks I. A quick compile, no errors, everything looks good.
But, when the application is run ... I got an error dialog saying “There is no source code available for the current location”:
Eh? I thought the technology was called WPF, not WTF!
The exception dialog that followed wasn’t much help either = “Cannot locate resource window1.xaml”:
But, thought I - I've already changed all the references to window1.xaml ... haven't I?
After some searching with Google and pulling of hair, I found the culprit – in my App.xaml file:
1: <Application
2: x:Class="PocDemoA.App"
3: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5: StartupUri="Window1.xaml">
6: <Application.Resources>
7: 8: </Application.Resources>
9: </Application>
The StartupUri setting that needed to be updated to the new name of my form.
1: <Application
2: x:Class="PocDemoA.App"
3: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5: StartupUri="Controller.xaml">
6: <Application.Resources>
7: 8: </Application.Resources>
9: </Application>
One Problem solved, a thousand more to go.

Recent comments
6 days 7 hours ago
1 week 10 hours ago
1 week 1 day ago
1 week 2 days ago
2 weeks 3 days ago
10 weeks 5 days ago
18 weeks 3 days ago
18 weeks 3 days ago
18 weeks 3 days ago
18 weeks 3 days ago