title: Binding to a sum of SelectedItems in WPF GridView
body: <p>I have a GridView that contains a list of files, created dates, and file sizes.  Below the grid I have a textblock that says "X Files Selected.  Y MB".  I can bind to SelectedItems.Count just fine, but can I easily bind to the sum of the file sizes for those that are selected?</p>
  
  <p>The question marks below should be the sum of the SelectedItems fileSize column values.  Any ideas?</p>
  
  <pre><code>&lt;TextBlock HorizontalAlignment="Right"&gt;
          &lt;TextBlock.Text&gt;
              &lt;MultiBinding StringFormat=" {0} Files Selected. {1} MB"&gt;
                  &lt;Binding ElementName="FilesList" Path="SelectedItems.Count"&gt;&lt;/Binding&gt;
                  &lt;Binding ElementName="FilesList" Path="SelectedItems.?????"&gt;&lt;/Binding&gt;
              &lt;/MultiBinding&gt;
          &lt;/TextBlock.Text&gt;
  &lt;/TextBlock&gt;
  </code></pre>
  
  <p>I know I can get this done in the codebehind - but I'd like to keep my codebehind empty and do it in the XAML.  This is the codebehind code:</p>
  
  <pre><code>private void FilesList_SelectionChanged(object sender, SelectionChangedEventArgs e)
  {
      double x = 0;
  
      foreach (FileInfo fileInfo in FilesList.SelectedItems)
      {
          x += fileInfo.Length;
      }
  }
  </code></pre>