Hi,
My xamwebgrid is bound to an observable collection data source and it is working fine - i.e.
grdOrders.ItemsSource = e.Result;
I would like to convert to an hierarchy xamwebgrid. Currently I have another observable collection data source for the child - order details. How can I combine these 2 collections so that I can bind it to a datasource on the same grid? Thanks for your help!
You'd need to assign pull down the employees associated with a specific manager, and create a collection of them which you'd then assign to the Manager object.
-SteveZ
Hi Stephen,
This is what I have:
public class Manager {
public ObservableCollection<Employee> Employees{get;set;}
private string _managerId; private string _managerLstNm; public string VPAProductId { get { return _managerId;} set { _managerId = value; } } }
public class Employee {
private string _managerId; private string _employeeLstNm;
public string ManagerId { get { return _managerId;} set { _managerId= value; } }
public string EmployeeName { get { return _employeeLstNm;} set { _employeeLstNm= value; } } }
In the service I have this for the manager and similar for the employee
[OperationContract] public List<Manager>GetData()
{ ...... ......
var mgrList = new List<Manager>();
if (ds.Tables[0].Rows.Count > 0) {
for (int i = 0; i < ds.Tables[0].Rows.Count; i++) {
GetEmployee(ds.Tables[0]); //Get employees
manager.VPAProductId = myrow["id"].ToString(); manager.VPAProductDesc = myrow["lstnm"].ToString(); mgrList.Add(manager); }
}
return mgrList; }
Based on the above, can you help me to create hierarchy webgrid? Thanks for your help!!
So the hierarchy has to be built into your data model.
So, if you had an ObservableCollection<Manager>, and you had another collection of ObservableCollection<Employee> and you wanted to have the employees collection be associated with the manager.
Then your Manager object, should have a property called Employees of type ObservableCollection<Employee>
public class Manager
{