I'm creating a datagrid filter using Expressions
in WPF. As my class I use ExpandoObject
with both hardcoded and dynamically added properties. When I filter columns with static properties it works, but when I filter columns with dynamic properties i get an error that the property cannot be found.
// error here
var targetProperty = Expression.Property(parameter, Member);
// i.e.: parameter.Member.ToString().
var toStringCallExpression = Expression.Call(targetProperty, _toStringMethodInfo);
// i.e.: parameter.Member.ToString().Contains(Value).
return Expression.Call(toStringCallExpression, _containsMethodInfo, Expression.Constant(Value));
How can i get member expression of dynamic properties, that are not instance properties?