How to use a App.config file in WPF applications?

Posted by Edward Tanguay on Stack Overflow See other posts from Stack Overflow or by Edward Tanguay
Published on 2009-04-30T09:49:28Z Indexed on 2010/04/09 2:53 UTC
Read the original article Hit count: 681

Filed under:
|

I created a App.config file in my WPF application:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appsettings>
    <add key="xmlDataDirectory" value="c:\testdata"/>
  </appsettings>
</configuration>

Then I try to read the value out with this:

string xmlDataDirectory = ConfigurationSettings.AppSettings.Get("xmlDataDirectory");

But it says this is obsolete and that I should use ConfigurationManager which I can't find, even searching in the class view.

Does anyone know how to use config files like this in WPF?

© Stack Overflow or respective owner

Related posts about wpf

Related posts about configuration