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
20
Combobox and Related Objects
posted

Hi,

 

I was trying to use a xamcombobox in my xamdatagrid and I have some questions.

1) Is it possible to bind the column to an Object, insted of a value?

Supposing I have a Employee class and a Department class (an Employee has a reference to a Department instance):

public class Employee 
{

pivate int id;
public int ID
{
get{return id;}
set{id=value;} 

private String name;

 

public String Name
{
get { return name; }
set { name = value; }
}

private Department dep;

public String AssignedDepartment
{
get{return dep;}
set{dep=value;} 

 

}

public class Department
{

private int id;
public int ID
{
get{return id;}
set{id=value}
}

private String name;

 

public String Name
{
get { return name; }
set { name = value; }
}

}

 

What I want  is having a datagrid displaying Employees, and a column with the AssignedDepartment and a combobox that permits to change it.
I can display the combobox but I can't display or set the selected value on the grid.

Is this possible? Or the combobox works only with standard data types (such an integer ID) ? How should I proceed?

Thanks a lot. 

  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. So I have been looking through your post and I created a sample project for you in which I used your classes to create data and bind it to a XamDataGrid with a Field using a XamComboEditor.

     

    Feel free to write me if you have further questions.

    xamDataGridWithComboEditor.zip