title: Data Binding not working for Datagrid in wpf using Collectionview source
body: <p>Here the code snippet for the data grid bind as static source of collection view source.
  But the datagrid not showing the required result.</p>
  
  <pre><code> &lt;Window.Resources&gt;
          &lt;local:EDiscoveryCoreDataList x:Key="CoreData"/&gt;
          &lt;CollectionViewSource x:Key="cvsCoreData" Source="{StaticResource CoreData}" Filter="CollectionViewSource_Filter"&gt;
          &lt;/CollectionViewSource&gt;
      &lt;/Window.Resources&gt;
  &lt;Grid Grid.Row="2" Grid.Column="0"&gt;
              &lt;Canvas x:Name="PanelCanvas1" &gt;
                  &lt;DataGrid ItemsSource="{Binding Source={StaticResource cvsCoreData}}"  SelectedCellsChanged="Data_SelectedCellsChanged" SelectionUnit="Cell" IsReadOnly="True" Style="{StaticResource AzureDataGrid}" AutoGenerateColumns="False" x:Name="Data" Canvas.Top="29" Width="1063" Height="536" VerticalScrollBarVisibility="Auto"&gt;
                      &lt;!--&lt;DataGrid.Columns&gt;
                          &lt;DataGridTextColumn Header="Key Term" Binding="{Binding KeyTerm }" /&gt;
                          &lt;DataGridTextColumn Header="Key Term Description" Binding="{Binding KeyTermDescription}" /&gt;
                          &lt;DataGridTextColumn Header="Short Hand" Binding="{Binding ShortHand}" /&gt;
                          &lt;DataGridTextColumn Header="Rule" Binding="{Binding Rule}" /&gt;
                      &lt;/DataGrid.Columns&gt;--&gt;
                      &lt;DataGrid.RowDetailsTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;TextBlock Text="{Binding Synonyms}"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGrid.RowDetailsTemplate&gt;
                      &lt;DataGrid.ContextMenu&gt;
                          &lt;ContextMenu&gt;
                              &lt;MenuItem Header="View in Document" /&gt;
                              &lt;MenuItem Header="Add/Edit Key Terms or Synonyms" /&gt;
                              &lt;MenuItem Header="Add/Edit Scoring Answers" /&gt;
                              &lt;MenuItem Header="Edit Rule" /&gt;
                          &lt;/ContextMenu&gt;
                      &lt;/DataGrid.ContextMenu&gt;
                  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Data Class:</p>
  
  <pre><code>public class EDiscoveryCoreData
      {
          internal string PartNo;
          internal string Section;
          private List&lt;string&gt; _synonyms;
          public string Synonyms
          {
              get
              {
                  string returnstring = string.Empty;
                  foreach (string synonyms in _synonyms)
                  {
                      returnstring += synonyms + "\n";
                  }
                  return returnstring;
              }
  
          }
          public string KeyTerm { get; set; }
  
          public string KeyTermDescription { get; set; }
  
          public string ShortHand { get; set; }
  
          public string Rule { get; set; }
  
          public EDiscoveryCoreData() { }
          public EDiscoveryCoreData(string PartNo, string Section, string KeyTerm, string KeyTermDescription, string ShortHand, string Rule, List&lt;string&gt; synonyms):this() 
          {
              this.KeyTerm = KeyTerm;
              this.KeyTermDescription = KeyTermDescription;
              this.PartNo = PartNo;
              this.Rule = Rule;
              this.Section = Section;
              this.ShortHand = ShortHand;
              this._synonyms = synonyms;
  
          }
  
  
      }
  </code></pre>
  
  <p>Collection Class:</p>
  
  <pre><code>    public class EDiscoveryCoreDataList : ObservableCollection&lt;EDiscoveryCoreData&gt;
      {
          //public List&lt;EDiscoveryCoreData&gt; DataList { get; set; }
  
          public EDiscoveryCoreDataList():base()
          {
              //DataList = new List&lt;EDiscoveryCoreData&gt;();
          }
          public void Add( EDiscoveryCoreData data)
          {
              base.Add(data);
          }
  
          //public List&lt;EDiscoveryCoreData&gt; GetList() 
          //{
          //    return DataList;
          //}
  
  
          public List&lt;string&gt; GetPartNo()
          {
              List&lt;string&gt; partList = this.Select(data =&gt; data.PartNo).ToList();
              partList.Insert(0, "All");
  
              return partList.Distinct().ToList();
          }
  
          public List&lt;string&gt; GetSection()
          {
              List&lt;string&gt; sectionList = this.Select(data =&gt; data.Section).ToList();
              sectionList.Insert(0, "All");
  
              return sectionList.Distinct().ToList();
          }
  
          public List&lt;EDiscoveryCoreData&gt; GetFilterData(string partno, string section)
          {
              //Console.WriteLine(partno + "======" + section);
              if (section == null)
                  section = string.Empty;
              List&lt;EDiscoveryCoreData&gt; filteredData;
              if (partno.Equals("All") &amp;&amp; section.Equals("All"))
                  return this.ToList();
              else if (partno.Equals("All") &amp;&amp; !section.Equals(""))
                  filteredData = this.Where(data =&gt; (data.Section.Equals(section))).ToList();
              else if (section.Equals("All"))
                  filteredData = this.Where(data =&gt; (data.PartNo.Equals(partno))).ToList();
              else
                  filteredData = this.Where(data =&gt; (data.PartNo.Equals(partno) &amp;&amp; data.Section.Equals(section))).ToList();
              return filteredData;
          }
  
          public List&lt;EDiscoveryCoreData&gt; GetFilterData(string searchstring)
          {
              Console.WriteLine(searchstring);
              if (searchstring.Equals(string.Empty))
                  return this.ToList();
              else
                  return this.Where(data =&gt; (data.KeyTerm.ToUpper().Contains(searchstring.ToUpper()))).ToList();
          }
  
          public List&lt;string&gt; GetListofKeyTerm()
          {
              return this.Select(keyterm =&gt; keyterm.KeyTerm).ToList();
  
          }
      }
  }
  </code></pre>
  
  <p>Populate the collection</p>
  
  <pre><code>internal EDiscoveryCoreDataList CoreDataList;
          public Brush BorderColor { get; set; }
          public MainWindow()
          {
              InitializeComponent();
              CoreDataList = (EDiscoveryCoreDataList)this.Resources["CoreData"];
              //CoreDataList.Add(new EDiscoveryCoreData("aa", "bb", "cc", "dd", "ee", "ff", new List&lt;string&gt; { "abc" }));
              PanelCanvas.Visibility = Visibility.Hidden;
              PanelCanvas1.Visibility = Visibility.Hidden;
              Data.SelectionMode = DataGridSelectionMode.Extended;
              BorderColor = new SolidColorBrush(Color.FromRgb(0xff, 0xff, 0xff));
          }
  
  
          internal void PopulateMainWindow(EDiscoveryCoreDataList coredatalist)
          {
              CoreDataList = coredatalist;
          } 
  </code></pre>
  
  <p>Here I populate the collection by calling the the function from another child window.</p>