Quite often I will set up WPF UserControl with a declarative DataContext:
<UserControl...>
<UserControl.DataContext>
<local:SomeModel x:Name="Model" />
</UserControl.DataContext>
</UserControl>
When in design mode, Visual Studio will attempt to instantiate the DataContext. However, when the DataContext is pulling data from a configuration file, Visual Studio 2010 will throw an error such as:
Cannot create an instance of "SomeModel".
When the error is thrown, the design time experience is of little or no value. If I comment out the DataContext, then the Visual Studio 2010 design mode works as expected, sans DataContext.
Is there a way to have Visual Studio ignore the XAML declared DataContext at design time?