views:

68

answers:

1

Consider a ViewModel and an View that uses it, where the DataContext is set to the VM in the code behind file. When they are both at the project namespace, the view runs without exceptions with binding statements along the lines of: ItemsSource="{Binding Path=PrefixFilterChoices}"

where PrefixFilterChoices is a property on the VM. When I refactor the project so that ViewModels and Views are each in their own namespace within the project, I now get a runtime error (System.IO.IOException' occurred in PresentationFramework.dll, cannot find the resource projectView.xaml).

1) I can't figure out who is looking for the resource though, so I'm not sure what the fix is. The code behind is still setting the DataContext and it has the new namespace for the ViewModel. Must I add it to the XAML also? Must I alias it and now qualify the Path for all of the bindings?

2) I use resharper, which has always been spot on the money at refactoring namespace changes; but it isn't helping even a little with the XAML. Are there any tools that do better XAML refactorings?

Cheers,
Berryl

A: 

Part of the answer is that refactoring the namespace affected the application StartupUri. I couldn't get the format right in the xaml so I just set the MainWindow in an application startup event.

Berryl