title: WPF MVVM - Combo box inside data grid
body: <p>I Have a data grid of objects (CopyObject) , each object contains list of objects (PGroupGridObject) that i want to display inside combo box.</p>
  <p>My View Model :</p>
  <pre><code>private ObservableCollection&lt;CopyObject&gt; foldersToCopy;
          public ObservableCollection&lt;CopyObject&gt; FoldersToCopy 
  { get =&gt; foldersToCopy; set { foldersToCopy = value; OnPropertyChanged(&quot;FoldersToCopy&quot;); } }
  </code></pre>
  <p>CopyObject class :</p>
  <pre><code> public class CopyObject 
      {
          public ObservableCollection&lt;PGroupGridObject&gt; pGroups;
          public CopyObject(string s , ObservableCollection&lt;PGroupGridObject&gt; pGroups)
          {
              Name = s;
              IsFolder = (File.GetAttributes(Name) &amp; FileAttributes.Directory) == FileAttributes.Directory;
              this.pGroups = pGroups;
          }
          public string Name { get; set; }
      }
  </code></pre>
  <p>PGroupGridObject class :</p>
  <pre><code>public class PGroupGridObject : ViewModelBase
      {
  
          public PGroupGridObject(object o)
          {
              Object = (DeployTool.Domain.Model.PGroup)o;
              PGroupName = Object.Name;
              ProductName = Object.Project_Product.Name;
          }
          private bool isChecked { get; set; }
          private string pGroupName;
          public string PGroupName
          {
              get { return pGroupName; }
              set
              {
                  pGroupName = value;
                  OnPropertyChanged(&quot;PGroupName&quot;);
              }
          }
  
          public bool IsChecked
          {
              get { return isChecked; }
              set
              {
                  isChecked = value;
                  OnPropertyChanged(&quot;IsChecked&quot;);
              }
          }
      }
  </code></pre>
  <p>my xaml :</p>
  <pre><code>        &lt;DataGrid ItemsSource=&quot;{Binding FoldersToCopy}&quot; Grid.Row=&quot;7&quot; Grid.Column=&quot;1&quot; SelectionUnit=&quot;FullRow&quot; RowHeaderWidth=&quot;0&quot; SelectedItem=&quot;{Binding CopyObjectSelected}&quot;
                    Style=&quot;{StaticResource DataGridStyle}&quot; d:ItemsSource=&quot;{d:SampleData ItemCount=2}&quot; AutoGenerateColumns=&quot;False&quot;
                    MinHeight=&quot;60&quot; MaxHeight=&quot;180&quot; Margin=&quot;0,10,0,10&quot;
                    Foreground=&quot;White&quot; Background=&quot;#292929&quot; FontSize=&quot;16&quot; BorderThickness=&quot;0&quot; HorizontalAlignment=&quot;Right&quot; MaxWidth=&quot;800&quot; MinWidth=&quot;600&quot; &gt;
                  &lt;DataGrid.Columns&gt;
                      &lt;DataGridTextColumn Header=&quot;File Path&quot; Binding=&quot;{Binding Name}&quot; CanUserResize=&quot;True&quot; MinWidth=&quot;520&quot;/&gt;
                      &lt;DataGridComboBoxColumn Header=&quot;PGroups&quot; 
                      ItemsSource=&quot;{Binding pGroups, UpdateSourceTrigger=PropertyChanged}&quot;
                      DisplayMemberPath=&quot;{Binding PGroupName}&quot;
                      /&gt;
  
                  &lt;/DataGrid.Columns&gt;
              &lt;/DataGrid&gt;
  </code></pre>
  <p>All the examples I found show Bind from the View Model and not from the object in the grid.
  the goal eventually is to display check box inside every group in combo box.</p>
  <p>I would appreciate help.</p>