title: Loaded event and data-binding in WPF
body: <p>Suppose we have a control with a dependency property:</p>
  
  <pre><code> public class MyControl : ContentControl
  {
  
      static MyControl()
      {
          DefaultStyleKeyProperty.OverrideMetadata(typeof(MyControl), new FrameworkPropertyMetadata(typeof(MyControl)));
      }
  
  
      void DoSomething(object sender, RoutedEventArgs e)
      {
          //...
  
      }
  
      public MyControl()
      {           
          this.Loaded += DoSomething;
      }
  
      public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
          "Value", typeof(string), typeof(MyControl),
          new FrameworkPropertyMetadata(default(string),
              FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal, OnValueChanged));
  
  
      private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
      {
          //some actions              
      }
  
      public string Value
      {
          get { return (string)GetValue(MyControl.ValueProperty); }
          set { SetValue(MyControl.ValueProperty, value); }
      }}
  </code></pre>
  
  <p>And somewhere in XAML we bind ValueProperty to some property Val of some ViewModel. </p>
  
  <p>My question is, at the moment when Loaded event is fired, will the value of MyControl.Value be already set to the value of Val which it has or not? So, am I able to use Val in DoSomething method which is executed when MyControl is loaded or not?</p>
  
  <p>Thank you in advance for any answers.</p>