title: Show Computed Property in Entity Framework and WPF UI
body: <p>I have a Download Entity in my EF Data Model.  Two of its properties, Size and BytesDownloaded, compute to give me the Progress property I've created in the partial class:</p>
  
  <pre><code>partial class Download
  {
      public int Progress
      {
          get
          {
              if (!Size.HasValue || Size.Value == 0) return 0;
              return Convert.ToInt32(Math.Floor(100.0 * ((double)BytesDownloaded / (double)Size)));
          }
      }
  }
  </code></pre>
  
  <p>In my WPF UI I have:</p>
  
  <pre><code>&lt;DataGridTemplateColumn x:Name="progressColumn" Header="Progress"  Width="*"&gt;
      &lt;DataGridTemplateColumn.CellTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;ProgressBar Value="{Binding Path=Progress, Mode=OneWay}" Maximum="100" /&gt;
         &lt;/DataTemplate&gt;
      &lt;/DataGridTemplateColumn.CellTemplate&gt;
  &lt;/DataGridTemplateColumn&gt;
  </code></pre>
  
  <p>Since Progress is not part of the Entity Model (edmx), I have to notify the UI that it should update the ProgressBar.  I thought I could do this like so:</p>
  
  <pre><code>partial void OnBytesDownloadedChanging(long value)
  {
      ReportPropertyChanging("Progress");
  }
  partial void OnBytesDownloadedChanged()
  {
      ReportPropertyChanged("Progress");
  } 
  </code></pre>
  
  <p>This compiles fine, but when I run the app and OnBytesDownloadedChanging/Changed are called, I get this exception on my call to ReportPropertyChanging/Changed:</p>
  
  <blockquote>
    <p>The property 'Progress' does not have
    a valid entity mapping on the entity
    object. For more information, see the
    Entity Framework documentation.</p>
  </blockquote>
  
  <p>I understand what the error message is saying, but I don't understand what I can do to actually accomplish my goal.</p>
  
  <p>PS - What specific "documentation" are they even referring to?  Sigh!  If they're going to imply there is documentation for this error, why don't they just link me to the documentation instead of telling me to [pointlessly] try and find it?</p>