I have this:
<ig:XamTree Name="vwEqTree" Width="200"> <ig:XamTree.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate x:Name="vwHClass"> <ig:HierarchicalDataTemplate.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate x:Name="vwHMakes"/> </ig:HierarchicalDataTemplate.HierarchicalItemTemplate> </ig:HierarchicalDataTemplate> </ig:XamTree.HierarchicalItemTemplate> </ig:XamTree>
I would like to be able to populate the items manually with:
vwHClass.Items.Add
i.e. without the Templates I can populate the top list vwEqTree.Items.Add(obervablelist<item>)
That works, but breaks when I add the templates.
What does this look like?
Hello foxjazz,
I have been looking through your snippets and I can suggest you check the following sample from our feature browser which shows how you can add new item from code when you have hierarchicaldatatemplat. Please refer to the code bellow the sample
http://samples.infragistics.com/sllob/RunSamples.aspx?cn=tree#/tree/node-selection
If this doesn’t suit your scenario or if you have any additional questions on this matter please feel free to ask.
I guess I am not being very clear. Manually I mean from code-behind.
Currently I have a half ass app working populating manually, but I am getting double events firing.
i.e.
if (currXti.Level == 3 && currXti.Items.Count == 0) { currXtiType = (XamTreeItem)vwEqTree.ActiveItem; prdAppSVM.LoadTypes((vwYear) currXti.Tag); prdAppSVM.DisplayEqType += new EventHandler(prdAppSVM_DisplayEqType); } if (currXti.Level == 4 && currXti.Items.Count == 0) { currXtiModel = (XamTreeItem)vwEqTree.ActiveItem; prdAppSVM.LoadModels((vwType)currXti.Tag); prdAppSVM.DisplayEqModel += new EventHandler(prdAppSVM_DisplayEqModel); } if (currXti.Level == 5 && currXti.Items.Count == 0) { currXtiEngine = (XamTreeItem)vwEqTree.ActiveItem; prdAppSVM.LoadEngines((vwModel)currXti.Tag); prdAppSVM.DisplayEqEngine += new EventHandler(prdAppSVM_DisplayEqEngine); } if (currXti.Level == 6) { prdAppSub.ItemsSource = prdAppSVM.LoadAppSub((EqAll)currXti.Tag); } } void prdAppSVM_DisplayEqEngine(object sender, EventArgs e) { currXtiEngine.Items.Clear(); foreach (Entity vcls in prdAppSVM.lEqEngines) { XamTreeItem xti = new XamTreeItem(); EqAll eqa = (EqAll)vcls; xti.Header = eqa.EquipmentEngine; xti.Tag = eqa; currXtiEngine.Items.Add(xti); } } void prdAppSVM_DisplayEqModel(object sender, EventArgs e) { currXti.Items.Clear(); foreach (Entity vcls in prdAppSVM.lEqModels) { XamTreeItem xti = new XamTreeItem(); vwModel vwm = (vwModel)vcls; xti.Header = vwm.EquipmentModel; xti.Tag = vwm; currXtiModel.Items.Add(xti); } } void prdAppSVM_DisplayEqType(object sender, EventArgs e) { currXti.Items.Clear(); foreach (Entity vcls in prdAppSVM.lEqTypes) { XamTreeItem xti = new XamTreeItem(); vwType vwt = (vwType)vcls; xti.Header = vwt.EquipmentType; xti.Tag = vwt; currXtiType.Items.Add(xti); } }