title: WINFORM or WPF: How to trigger custom event inside the constructor of the class that emits it
body: <p>I have a userControl11 (either in winform or wpf) which has a ValueChanged custom event. If I put it in client form and in form_load set its value to 100, it will trigger the ValueChanged event. But if I set this value inside the constructor of UserControl1 the custom event won't trigger. How can I force it to do so ?</p>
  
  <p>whatever the technical reason, functionally it does make sense. If the object is initializing its value from some sources unknown to the client form and the client form has a textbox bound to this usercontrol value, it is sure convenient that it could refresh its textbox at any time including when the form loads just using one single event handler. Without this the client form has to create another initializer for this bound textbox at form load. </p>
  
  <p>Below the source code of my trials in winform:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  
  namespace test
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void userControl11_ValueChanged()
          {
              MessageBox.Show(userControl11.Value.ToString());
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
             // This will trigger ValueChanged Event
              userControl11.Value = 100;
          }
      }
  }
  
  
  
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Drawing;
  using System.Data;
  using System.Text;
  using System.Windows.Forms;
  
  namespace customevent
  {
      [DefaultEvent("ValueChanged")]
      public partial class UserControl1 : UserControl
      {
          private int m_value;
  
          public delegate void ValueChangedHandler();
          [Category("Action")]
          [Description("Value changed.")]
          public event ValueChangedHandler ValueChanged;
  
          public int Value
          {
              get { return m_value; }
              set { 
                  m_value = value;
                  if (ValueChanged != null)
                  {
                      ValueChanged();
                  }
              }
          }
  
          public UserControl1()
          {
              InitializeComponent();
              // this won't trigger ValueChanged Event
              this.Value = 100;
          }
          public UserControl1(int iValue)
          {
              this.Value = iValue;
              InitializeComponent();
          }
  
      }
  }
  </code></pre>