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
280
Select different ItemTemplate in OrgChartNodeLayout depending on conditions
posted

Hello all, 

I need a scenario in which the item template of OrgChartNodeLayout(in GlobalNodeLayouts) needs to be different based on some conditions. 

For example:


<ig:XamOrgChart.GlobalNodeLayouts>
<ig:OrgChartNodeLayout
TargetTypeName="Department"
DisplayMemberPath="DepartmentName"
Key="Departments"

/>
</ig:XamOrgChart.GlobalNodeLayouts>


In above example, suppose if Department has sub-Departments, then, one template should be used.

But if that Department doesn't have Sub-Departments,instead ,has Employees, then other template should be used.

The class structure for Department class is :


public class Department
{
public Department(string name)
{
this.DepartmentName =name;
this.Departments = new ObservableCollection<Department>();
this.Employees = new ObservableCollection<Employee>();
}

public string DepartmentName { get; set; }

public ObservableCollection<Department> Departments { get; set; }
public ObservableCollection<Employee> Employees { get; set; }
}


If  Department has Sub-Departments, the Departments(Observable collection) will have value [Count > 1] and if it doesn't have Sub-Department, then the Employees will have value [Count > 1]. 

How can I achieve different Item Template based on above conditions? [For List Box , there is itemTemplateSelector, is there any similar approach in this one? ]

Thank you in advance for your time. 

Help..

Parents Reply Children
No Data