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

Filtering on a GridViewComboboxColumn with using a converter

6 Answers 325 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Abhinav
Top achievements
Rank 1
Abhinav asked on 02 May 2017, 09:04 PM

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

Sort by
0
Stefan Nenchev
Telerik team
answered on 05 May 2017, 02:40 PM
Hello Abhinav,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Abhinav
Top achievements
Rank 1
answered on 05 May 2017, 06:44 PM

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

0
Stefan Nenchev
Telerik team
answered on 10 May 2017, 11:48 AM
Hi Abhinav,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Abhinav
Top achievements
Rank 1
answered on 10 May 2017, 09:28 PM

Hi Stefan,

 

Thank you for your help, greatly appreciated. We'll give it a try and get back to you.

 

Kind regards

0
Abhinav
Top achievements
Rank 1
answered on 11 May 2017, 06:00 PM

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

0
Stefan
Telerik team
answered on 15 May 2017, 12:35 PM
Hi Abhinav,

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
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Abhinav
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Abhinav
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or