Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ComboBox not bining collection inside collection on DataGrid xaml wpf


What I have tried:

<pre>
xaml code inside DataGrid
<DataGridTemplateColumn Header="Unit" Width="65"> 
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <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:

if (dtUnit.Rows.Count > 0) 
   { 
     this.SaveCls.PurDtlMastCol[rowIndex].ItemUnitCol = new PL21000DCol(); 
     foreach (DataRow dr in dtUnit.Rows)
     {
        this.SaveCls.PurDtlMastCol[rowIndex].ItemUnitCol.Add(new PL21000D() { 
        UnitId = PLWM.Utils.CnvToInt64(dr["unit_id"]),
        UnitName = PLWM.Utils.CnvToStr(dr["unit_name"]) 
        });
     }
   }
Posted
Updated 25-Jul-18 6:00am
Comments
Graeme_Grant 25-Jul-18 10:05am    
What is the Output window telling you? I am guessing that you have a binding error.
Member 11220730 27-Jul-18 6:18am    
empty Combobox ,No error.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900