Hi Telerik,
We have column data where values are coming in as integer values of 0 or 1 and we are using a converter (using convert and convertback) to convert the 0/1 values to "Y/N" (i.e. simple type to simple type).
The converter is working well, however, the default Filter Control is showing the values "N/N". The filter should be showing "Y/N" or "N/Y" values, instead.
Please find the XAML for the GridViewComboboxColumn below, bound using MVVM.
...
<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding AnIntegerColumn, Converter={StaticResource IntegerToYNConverter}}" Header="AColumn" Width="80">
<telerik:GridViewComboBoxColumn.ItemsSource>
<x:Array Type="{x:Type sys:String}">
<sys:String>Y</sys:String>
<sys:String>N</sys:String>
</x:Array>
</telerik:GridViewComboBoxColumn.ItemsSource>
</telerik:GridViewComboBoxColumn>
...
Could you please advise?
Kind regards.
p.s. If there is a way to make this link fit our approach, please also advise: http://www.telerik.com/blogs/filtering-gridviewcomboboxcolumn-in-radgridview-for-wpf
6 Answers, 1 is accepted
Without having a sample that reflects your scenario we cannot be absolutely sure what is causing the issue, however, you can expose an additional property in your object which will return a string based on the integer value and eventually set this property to the FilterMemberPath of the column. I have attached a sample for your reference.
Regards,
Stefan Nenchev
Telerik by Progress
Hi Stefan,
Thank you for your reply.
We really wanted to avoid creating another property to resolve the issue, however, if this is the only way, we will take a look.
Kind regards
In order to avoid using an additional property, you can consider using a GridViewDataColumn and declare a ComboBox within its CellTemplate rather than be using a GridViewComboBoxColumn. I have attached a modified sample for your reference.
Regards,
Stefan Nenchev
Telerik by Progress
Hi Stefan,
Thank you for your help, greatly appreciated. We'll give it a try and get back to you.
Kind regards
Hi Stefan,
Thanks for your response. Ultimately, we couldn't go with the attached solution, since our POCOs are wrapped in proxy types. To code a coerced property for each converted property over the lifetime of the application will be daunting.
Kind regards
As I am not completely sure what your setup is, may I kindly ask you to share what is the obstacle to applying the approach with the CellTemplate? Is the approach of using this proxy class working as expected with a GridViewComboBoxColumn, but not applicable to defining the CellTemplate of the column? Generally, any details that you think might be related can be helpful.
Best Regards,
Stefan X1
Telerik by Progress