Search code examples
c#visual-studiowinformsapplication-settingsdesign-time

How do I apply the Settings.settings values at design time?


I have a panel in my Form like this:

enter image description here

and a Panel_BackColor in project's Settings.setting file:

enter image description here

I can change panel back color in the Form constructor:

public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
            panel1.BackColor = UI_Settings.Default.Panel_BackColor;
        }
    } 

All things work at runtime:

enter image description here

But nothing change at Design Time. How can I apply these settings at Design mode too?


Solution

  • I asked "not edited version" of this question on MSDN forum and got an answer within an hour.

    Questions like Convert int to string? is a good questions but mine is not! I think stackoverflow should keep a watch on it's editors and policy.

    The answer:

    Select your control in Form Designer (for example a button), go to Properties, (ApplicationSettings),(PropertyBinding), then bind BackColor or other property to Button_BackColor or other settings. Afterward by changing settings in Settings.settings file, all binded controls would be affected.