how to change configuration of WPF application at runtime by modifying App.config


  • I have following App.config in my WPF project.

    <?xml version="1.0" encoding="utf-8" ?>
        <add key="IPAddress" value=""/>
        <add key="Port" value="27015"/>
        <add key="Mode" value="Ucd"/>

    when I execute my application, it creates App file in output folder.

    I bound values of these keys to my application's UI.

    now, my requirement is when I explicitly change the value of specific key (e.g Mode = "Acd") I want it to be changed on UI when I directly run my .exe file without compilation. I found vice-versa solution (i.e. from UI to config file) on community but not this one.

    plz suggest.

    Tuesday, July 10, 2012 8:59 AM


All replies