Hi,
I am creating a generic grid solution based on the Telerik grid as a prototype to test the suitability of the Telerik components.
Our data layer can not send us typed objects. Instead it sends an object with an array of field names and an array of values.
Arrays
My first approach was to use a binding expression referencing the index to display i.e:
The grid does retrieve the values using this expression, but grouping, sorting and filtering are missing.
Dynamic object
Since this didn't work I thought I could trick the grid into thinking the model was strongly typed using a dynamic object that returned values based on the binding name:
This fixed grouping and sorting however filtering is still not working
I've have a simplified test project that demonstrates my findings, but the forum won't allow me to attach it. Any help resolving this issue would be most welcome.
I am creating a generic grid solution based on the Telerik grid as a prototype to test the suitability of the Telerik components.
Our data layer can not send us typed objects. Instead it sends an object with an array of field names and an array of values.
Arrays
My first approach was to use a binding expression referencing the index to display i.e:
DataMemberBinding="{Binding Path=Values[0]}"
The grid does retrieve the values using this expression, but grouping, sorting and filtering are missing.
Dynamic object
Since this didn't work I thought I could trick the grid into thinking the model was strongly typed using a dynamic object that returned values based on the binding name:
public
override
bool
TryGetMember(GetMemberBinder binder,
out
object
result)
{
if
(!
this
.AllFields.Contains(binder.Name))
{
return
base
.TryGetMember(binder,
out
result);
}
result =
this
.Values[
this
.AllFields.IndexOf(binder.Name)];
return
true
;
}
I've have a simplified test project that demonstrates my findings, but the forum won't allow me to attach it. Any help resolving this issue would be most welcome.