title: How can i set a default value for a dependency property of type derived from dependencyobject
body: <p>I am new to WPF and this is my first post. I have created a class called 'Fruit' that descends from 'DependencyObject' and adds and extra property called 'Apple'. I have created a new custom control that includes a Dependency Property called 'MyFruit' of type 'Fruit'. My question is, how can i set the default value for the properties within 'MyFruit' object (i.e. the 'Apple' property? I would like to set this in XAML using the  object.</p>
  
  <pre><code>public class Gauge : Control
  {
      .
      .
      .
  
      //---------------------------------------------------------------------
      #region MyFruit Dependency Property
  
      public Fruit MyFruit
      {
          get { return (Fruit)GetValue(MyFruitProperty); }
          set { SetValue(MyFruitProperty, value); }
      }
  
      public static readonly DependencyProperty MyFruitProperty =
          DependencyProperty.Register("MyFruit", typeof(Fruit), typeof(CircularGauge), null);
  
      #endregion
  
  
  } 
  
  
  //-------------------------------------------------------------------------
  #region Fruit class
  
  public class Fruit : DependencyObject
  {
      private int apple;
  
      public int Apple
      {
          get { return apple; }
          set { apple = value; }
      }
  
   }
  
  #endregion
  </code></pre>