I have this ComboBox
<ComboBox Name="company" Width="120"
HorizontalAlignment="Right" Margin="5"
IsSynchronizedWithCurrentItem="True"
ItemsPanel="{DynamicResource Virtualized}"
ItemsSource="{x:Static local:Repository.Customers}"
SelectedItem="{Binding Path=SelectedCustomer}"
DisplayMemberPath="CM_FULL_NAME""/>
It runs. It works. Except in the designer, which won't let me do anything because of the error:
ArgumentException was thrown on "StaticExtention": Exception has been thrown by the target of an invocation.
Detail
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
I have tried several things in the static class to skip the constructor in designtime, none of which fix the error:
if (LicenseManager.UsageMode == LicenseUsageMode.DesignTime)
if (DesignerProperties.GetIsInDesignMode(this))
if (System.Reflection.Assembly.GetExecutingAssembly().Location.Contains("VisualStudio"))
And returning in the constructor if any of these are true. Still getting the error.
Edit: Not sure if it makes any difference, but the static repository class uses EF4 to get from a database.
Edit2: Also tried ItemsSource {Binding} to the static lists, still get the same error. Note, calling it a repository is a misnomer, the lists are loaded on startup and never changed. Below answer does not work, still trying to figure this out.
Edit3: Thomas' Suggestion to debug design mode wasn't doable. I am using VS2010 Express, and the tools menu does not have an attach to process option. I still don't know why this breaks the designer and works in runtime.