title: System.Configuration.ConfigurationManager does not work in Visual Studio designer
body: <p>I'm working on a WPF application in Visual Studio 2010.  </p>
  
  <p>When application windows are loaded into the designer, attempts to retrieve connection strings or app settings always return null.  E.g., if I have an app setting called "foo" with value "bar", in the designer, <code>ConnectionManager.AppSettings["foo"]</code> will return null, while at runtime, it will return "bar".  This is causing me some consternation, since my window is now throwing exceptions in the designer.</p>
  
  <p>Is this a known bug (or "feature") in Visual Studio?  I haven't been able to find mention of it elsewhere.  </p>
  
  <p>If any of you have encountered this before, is there a common workaround available?</p>
  
  <p>EDIT, per Phil's request:</p>
  
  <p>This can be trivially replicated by placing a label in a Window, à la:</p>
  
  <pre><code> &lt;Label Content="{Binding TheText}" HorizontalAlignment="Left" /&gt;
  </code></pre>
  
  <p>And in the viewmodel, setting the TheText element to the value of the application setting "foo":</p>
  
  <pre><code>TheText = ConfigurationManager.AppSettings["foo"];
  </code></pre>
  
  <p>The app.config contains the following appSettings section: </p>
  
  <pre><code>&lt;appSettings&gt;
      &lt;add key="foo" value="bar"/&gt;
  &lt;/appSettings&gt;
  </code></pre>
  
  <p>EDIT: I've marked Phil's solution as the correct one, since it seems like using the settings API is the only way around this.  Sadly, it's not a viable workaround in all cases.  I've raised an issue on MS Connect about this: <a href="https://connect.microsoft.com/VisualStudio/feedback/details/738316/system-configuration-configurationmanager-does-not-work-in-wpf-designer" rel="nofollow">https://connect.microsoft.com/VisualStudio/feedback/details/738316/system-configuration-configurationmanager-does-not-work-in-wpf-designer</a></p>