Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have requirement to make Font related properties as configurable in my window application. But how to set FontStyle attribute in App.config & use it in my application (problem is that FontStyle is enumaration and how to convert string value to FontStyle)
Thanks in advance.
Posted

 
Share this answer
 
If you are really required app.config and nothing else (it could be any kind of configuration file holding current options which could be saved and loaded during runtime any time, in contrast to app.config), you need to read this:
https://msdn.microsoft.com/en-us/library/2tw134k3%28v=vs.140%29.aspx[^].

I hope, application of fonts and other properties won't be a problem for you.

Above, I explained you the benefit of using not configuration file, but something else. Another problem with app.config is: if this file can be used for some "serious" application tune-up, so contaminating it with many custom sections would be pretty bad. This is another reason for saving the UI options in a separate file. Most usually, settings are used, but I think they are obsolete, not flexible enough, so I never use this feature, use my own file instead. Please see:
https://msdn.microsoft.com/en-us/library/ms733127%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
Thanks for your help.
I found http://stackoverflow.com/questions/8148622/get-enum-values-from-web-config-at-run-time[^] very useful and solve my issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900