title: WPF how to use DesignerProperties.IsInDesignTool to solve a design time error "cannot create an instance"?
body: <p>I have the following class that I use in order to populate a combo box:</p>
  
  <pre><code>public class DamageTypeList
  {
      static Begbil2Entities _DB = new Begbil2Entities();
      public static List&lt;HUB_DamageTypes&gt; _list = (from d in _DB.HUB_DamageTypes orderby d.DamageOrder select d).ToList(); 
  
      public static List&lt;HUB_DamageTypes&gt; TList
      {
          get
          {
              return _list;
          }
      }
   }
  </code></pre>
  
  <p>In the xaml file I add it like this:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;me:DamageTypeList  x:Key="DamageTypeList"/&gt;
  </code></pre>
  
  <p>The xaml line creates an error (ONLY in design time, it runs pefectly at runtime):</p>
  
  <p>Cannot create an instance of "DamageTypeList".  C:\HUB\HUB\HubbCostOfferPage.xaml</p>
  
  <p>I have found some suggestions to solve it by using: </p>
  
  <pre><code>if (!DesignerProperties.IsInDesignTool)
  </code></pre>
  
  <p>But how do I use it to solve my problem? </p>