Tijo  Johnson C

Tijo Johnson C

  • NA
  • 136
  • 9.3k

Combobox not bining collection inside collection on Datagrid

Jul 25 2018 4:50 AM
xaml code inside DataGrid
  1. <DataGridTemplateColumn Header="Unit" Width="65"> <DataGridTemplateColumn.CellTemplate>  
  2. <DataTemplate>  
  3. <my:PLGDComboBox Height="23" ItemsSource="{Binding Path=SaveCls.PurDtlMastCol[RowIndx].ItemUnitCol,RelativeSource={RelativeSource AncestorType={x:Type invname:MasterForm},AncestorLevel=1,Mode=FindAncestor},UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" SelectedValue="{Binding Path=PurUnit.UnitId,UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" DisplayMemberPath="UnitName" SelectedValuePath="UnitId"/> </DataTemplate > </DataGridTemplateColumn.CellTemplate>  
View Model Code:
  1. if (dtUnit.Rows.Count > 0)  
  2. {  
  3. this.SaveCls.PurDtlMastCol[rowIndex].ItemUnitCol = new PL21000DCol();  
  4. foreach (DataRow dr in dtUnit.Rows)  
  5. {  
  6. this.SaveCls.PurDtlMastCol[rowIndex].ItemUnitCol.Add(new PL21000D()  
  7. {  
  8. UnitId = PLWM.Utils.CnvToInt64(dr["unit_id"]), UnitName = PLWM.Utils.CnvToStr(dr["unit_name"]) });  
  9. }  
  10. }  

Answers (1)