hello,
i am new to the telerik controls and i have a question to the radtreeview.
I have two normal classes and a hierarichal template. Everything works fine and the data is shown in tree.
Instead of the normal class i want to use the radtreeviewitem. I try to inherit wich works for the nodes but
not for the childs. Can you please give me a advice how to do this. Here is my code and my problem is
the Children property in the class recursiveObject. Thank you and greetings ....
public static ObservableCollection<
RecursiveObject
> FillRecursive(List<
FlatObject
> flatObjects, int parentId)
{
ObservableCollection<
RecursiveObject
> recursiveObjects = new ObservableCollection<
RecursiveObject
>();
foreach (var item in flatObjects.Where(x => x.ParentId.Equals(parentId)))
{
recursiveObjects.Add(new RecursiveObject
{
Data = item.Data,
NodeId = item.Id,
Menge = item.Menge,
Selected = false,
ParentKey = item.ParentId,
Children = FillRecursive(flatObjects, item.Id)
});
}
return recursiveObjects;
}
public class FlatObject
{
public int Id { get; set; }
public int ParentId { get; set; }
public string Data { get; set; }
public int Menge { get; set; }
public FlatObject(string name, int id, int parentId, int menge)
{
Data = name;
Id = id;
ParentId = parentId;
Menge = menge;
}
}
public class RecursiveObject : RadTreeViewItem
{
public bool Selected { get; set; }
public int NodeId { get; set; }
public int ParentKey { get; set; }
public string Data { get; set; }
public int Menge { get; set; }
public ObservableCollection<
RecursiveObject
> Children { get; set; }
}