This is a migrated thread and some comments may be shown as answers.

Expression Editor: Multiple Objects

3 Answers 141 Views
ExpressionEditor
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 19 Oct 2011, 08:16 PM
Is it possible to give the have the Expression Editor pull properties from multiple object for the fields in the tree view?  Also, is it possible to make the Editor check if child objects of the object it is passed have properties?

Thank you very much

3 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 21 Oct 2011, 02:21 PM
Hi ,

 Currently this is not possible. Possible approach will be to provide new class combining all needed properties from all classes. 

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ron
Top achievements
Rank 1
answered on 21 Oct 2011, 10:33 PM
Would you happen to know if there is a was to dynamically generate this composite class? I have tried using a dynamic object class and also an ExpandoObject but have not had luck with either.

Thanks Again
0
Ron
Top achievements
Rank 1
answered on 21 Oct 2011, 11:24 PM
Correction, I was able to get an expandoObject to work.
public object MakeComposite(List<object> objects)
{
    dynamic composite = new ExpandoObject();
 
    ExpandoObject e = composite as ExpandoObject;
 
    foreach (object obj in objects)
    {
        foreach (PropertyInfo info in obj.GetType().GetProperties())
        {
            (e as IDictionary<string, object>).Add(info.Name, info.GetValue(obj,null));
        }
    }
    return composite;
}
Tags
ExpressionEditor
Asked by
Ron
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Ron
Top achievements
Rank 1
Share this question
or