title: how to wrap wpf datagrid columns text when it is populated using a List dynamically?
body: <p>I have an xaml like:</p>
  
  <pre><code>&lt;GroupBox Header="groupBox1" Height="174" HorizontalAlignment="Left" Margin="36,38,0,0" Name="groupBox1" VerticalAlignment="Top" Width="285"&gt;
          &lt;ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"&gt;
              &lt;Grid x:Name="caseListGrid"&gt;
              &lt;/Grid&gt;
          &lt;/ScrollViewer&gt;
  &lt;/GroupBox&gt;
  </code></pre>
  
  <p>and in the .cs file i have a function:</p>
  
  <pre><code>private void LoadDataGrid()
  {
      caseElementList = new List&lt;CaseElement&gt;();
      caseElementList.Clear();
  
      //add 1st element
      caseElementList.Add(new CaseElement
      {
          CaseName = "First Name",
          Description = "Recently I came across the need to customize the look of the standard message box in the application. To do this I’ve decided to create a new class named WPFMessageBox"
      });
  
      //add second
      caseElementList.Add(new CaseElement
      {
          CaseName = "Second Name",
          Description = "Recently I came across the need to customize the look of the standard message box in the application. To do this I’ve decided to create a new class named WPFMessageBox"
      });
  
      caseElementList.Add(new CaseElement
      {
          CaseName = "Third Name",
          Description = "Recently I came across the need to customize the look of the standard message box in the application. To do this I’ve decided to create a new class named WPFMessageBox"
      });
  
  
      DataGrid dGrid = new DataGrid();                        
      dGrid.AutoGenerateColumns = true;            
      dGrid.ItemsSource = caseElementList;
      this.caseListGrid.Children.Add(dGrid);
  }
  </code></pre>
  
  <p>here in the function i have created a List of custom case objects. Then i have assigned the list to the datagrid (after creating the datagrid). </p>
  
  <p>But as because i have not added styles in the datagrid.. and the texts are very big. So, 
  it is expanding in a scrollview. </p>
  
  <p>But i want to display them using text wrapping. So, can anyone give me any solution?? </p>
  
  <p>I have found that using textblock it can be solved. But i can't figured out how i can add textblocks in that datagrid as because i am creating this dynamically..!!</p>