Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
343
Populate ComboBox inside xamDataGrid
posted

i have a xamDatagrid set up as follows :

 <igDP:XamDataGrid DataSource="{Binding}" x:Name="xamContact" >
 <igDP:XamDataGrid.FieldLayouts> <
igDP:FieldLayout>
 <igDP:Field Name="DepartmentName" Label="Department Name" /> 
<igDP:Field Name="FirstName" Width="100" Label="First Name" /> 
<igDP:Field Name="LastName" Label="Last Name" />
 <igDP:Field Name="RoleName" Label="Role Name" />
 <igDP:ComboBoxField Name="Contactby" Visibility="Visible"
 ItemsSource="{Binding}" Label="Contactby">igDP:ComboBoxField> 
<igDP:Field Name="ContactType" Label="ContactType" Visibility="Collapsed" /> igDP:FieldLayout> 
igDP:XamDataGrid.FieldLayouts>

in the code behind i want populate the xamDataGrid included the ComboBox field"Contactby"(situated in the xamDataGrid) as follows:

 public DataTable GetContTable() 
{ DataTable tableCont = new DataTable();
tableCont.Columns.Add("DepartmentName", typeof(string)); 
tableCont.Columns.Add("FirstName", typeof(string)); 
tableCont.Columns.Add("LastName", typeof(string));
tableCont.Columns.Add("RoleName", typeof(string));
 tableCont.Columns.Add("Contactby", typeof(object)); 
tableCont.Columns.Add("ContactType", typeof(string));
 tableCont.Columns[5].ColumnMapping = MappingType.Hidden;
 // tableCont.Columns[4].ColumnMapping = MappingType.Hidden; 
return tableCont; } 
public void AddRowsCont(DataTable dtcont)
 { string[] card = new string[1000]; 
for (int i = 0; i < lstContactBy.Items.Count; i++)// there are 3 items in this listbox as follow "PLANNING","RESERVATION","ASSISTANCE" 
{ card[i] = lstContactBy.Items[i].ToString(); } 
dtcont.Rows.Add(txtDepartment.Text, txtFirstName.Text, txtlastName.Text, txtROlename.Text,card ,"SKYPE"); }
 //here is the button to insert the data in the x
amfdatagrid AddRowsCont(tableCont);
 xamContact.DataSource = tableCont.DefaultView;

the result is the xamdatagrid can be populate instead the ComboBox "Contactby" is populate only with a message'String[] Array' How i can populate also the ComboBox with the three items without error?

Thanks a lot