I'm using RadGridView to show certain properties of a list of elements.
This works as expected as long as all elements in the list have all properties the columns bind to.
But once only one element does not have a property a column binds to the whole columns fails to correctly support sorting and filtering.
When sorting no element is shown at all and the filter dialog does not show any values. See attached screenshots.
This still happens even though a FallbackValue of the right type is provided in the Binding.
Is there a way to make this work? Sadly I can not avoid having some elements that do not implement all properties, so a failing binding most be handled in a better way.
My Xaml:
<
Window
x:Class
=
"WpfTestApplication.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikG
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:telerikD
=
"clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
Title
=
"MainWindow"
Height
=
"200"
Width
=
"300"
>
<
Grid
>
<
telerikG:RadGridView
ItemsSource
=
"{Binding Elements}"
AutoGenerateColumns
=
"False"
>
<
telerikG:RadGridView.Columns
>
<
telerikG:GridViewDataColumn
Header
=
"cost"
DataMemberBinding
=
"{Binding cost, FallbackValue=0.0}"
/>
</
telerikG:RadGridView.Columns
>
</
telerikG:RadGridView
>
</
Grid
>
</
Window
>
7 Answers, 1 is accepted
I have tried reproducing the issue you have described but was not able to. I have recorded the behavior and you can review it at http://screencast.com/t/l26cmAGhI. Can you please provide some more information regarding the setup at your end and more specifically the data source for the grid?
I have also created a sample project for you. Would it be possible to modify it so that it represents the undesired behavior and send it over so I can have a more detailed look and hopefully find the root of the issue?
I am looking forward to your reply, Peter.
Regards,
Stefan Nenchev
Telerik
Hello Stefan,
I was able to modify your example.
You just set a property to null. But my Problem is triggered when a object is off a different type has does not have a certain property at all.
The problem is probably also related to the fact that our models use the ICustomTypeDescriptor interface to expose properties at runtime.
Regards,
Peter Grüner
Hi Peter/Stefan,
Old post I know but I'm currently having a very similar problem (null values in runtime-generated columns causing sort and filter to fail as described in Peters's original post/screenshots). I'm using ExpandoObject to create the column data. Grid sorts/filters perfectly if a column has no null values BTW.
Currently using build 2017.2.614.
Any help would be much appreciated.
Best regards,
Frazz
The issue reported in this thread rooted in the fact, that there were missing properties in the bound item that the data engine of RadGridView is searching for. The malfunction in such case would be the expected one. However, you stated setting null values instead, which is supported for an object implementing IDynamicMetaObjectProvider. With this in mind, can you please clarify whether you are simply setting a null value to a given property of the ExpandoObject, or you are defining columns that are bound to a property that is not present in the bound item?
Best Regards,
Stefan X1
Telerik
Hi Stefan,
Thanks for your reply. Makes sense re missing properties (I had jagged data). Removing the jaggedness solves my problem. I still have issues with filtering due to the use of dynamic properties and I presume this is still an issue (highlighted in a previous post of yours regarding dynamic data - http://www.telerik.com/forums/binding-radgridview-with-dynamic-column)?
Best regards,
Frazz
Firstly, please, excuse me for mistaking you with the previous user in this thread.
As to the issue you are experiencing, I am not completely sure what it is. Note, that if it is related to the filter operators that are generated for a dynamic type, as discussed in the forum thread to which you referred, this would be the expected behavior. Can you please clarify this?
Regards,
Stefan X1
Progress Telerik
Hi Stefan,
No worries re name :). Yep, I guess I'm saying that I do indeed have the issue with the default filtering options in regard to dynamic types so will probably implement a custom filter to get around that. Thanks for the help regardless.
Frazz