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

Distinct Values on ComboBoxColumn bug?

5 Answers 198 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Samuele
Top achievements
Rank 1
Samuele asked on 28 Jun 2012, 02:07 PM
I'm trying to make built-in filtering work with a comboboxcolumn.
My GridView is bound to an ObservableCollection of Racer entities.
Each Racer entity has a BikeID property (of type Guid) and a Bike navigation property (of type Bike).
My ViewModel has a class BikeService which has an Items Collection of ComboItemViewModel,
which in turn has "ID" and "Description" public properties.
The following code seems to be working, except for the distinct values part of the filtering control.
Basically, I get an exception for each distinct value because the filtering control is trying to parse
them as Guid, even if I instructed the GridView to filter on Bike.Description, which is a string.

Exception text:
System.Windows.Data Error: 17 : Cannot get 'ConvertedValue' value (type 'Object') from ''
(type 'DistinctValueViewModel'). BindingExpression:Path=ConvertedValue; DataItem='DistinctValueViewModel'
(HashCode=52842714); target element is 'CheckBox' (Name=''); target property is 'Content' (type 'Object')
TargetInvocationException:'System.Reflection.TargetInvocationException:
Eccezione generata dalla destinazione di una chiamata. --->
System.FormatException: Il GUID deve contenere 32 cifre, separate da quattro trattini (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

<
telerik:GridViewComboBoxColumn
                Header="Bike"
                DataMemberBinding="{Binding BikeID}"
                SortMemberPath="Bike.Description"
                FilterMemberPath="Bike.Description"
                      FilterMemberType="{x:Type sys:String}"
                ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.BikeService.Items}"
                SelectedValueMemberPath="ID"
                DisplayMemberPath="Description" />

I suspect this is a bug, or maybe this is not supported by the current version of GridView.

Thanks in advance,
Samuele Ruggieri

5 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 28 Jun 2012, 02:23 PM
Hello,

Please check this forum thread. There you can find an additional information on filtering ComboBoxColumn and a sample project attached.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Samuele
Top achievements
Rank 1
answered on 28 Jun 2012, 02:55 PM
I opened that sample project, and it shows the same behavior/bug. If you don't specify the FilterMemberPath, it will correctly convert the distinct values but you won't be able to use the filter operators, because they still expect an int value. If you use FilterMemberPath as I did, the filter operators work but the distinct values don't because the filtering control expects them to be int (Guids in my case). I'd like to be able to use both the distinct values checkboxes and the filter operators.

Best regards,
Samuele Ruggieri
0
Dimitrina
Telerik team
answered on 28 Jun 2012, 03:05 PM
Hello,

Would it be possible for you to isolate the problem you have in a demo project so that we could debug it locally?

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
MD
Top achievements
Rank 1
answered on 04 Oct 2012, 07:41 PM
Was this every looked at further?  I see they same issue.  When using the built-in filtering for the ComboBoxColumn the check list appears and works correctly off the ItemSources display field DisplayMemberPath, but specifying a filter using the operators at the bottom of the filter menu still works off the DataMemberBinding field of the Grid's source or SelectedValueMemberPath field which is usually a numeric value.
0
Rossen Hristov
Telerik team
answered on 05 Oct 2012, 01:43 PM
Hello,

Filtering can only be and is always performed on the actual raw data values. The DisplayMemberPath is for display purposes only and cannot be filtered on, since it does not participate in the actual data values.

In the distinct values list, the DisplayMemberPath is what you see on the surface because it is human-friendly, but when you click a distinct value it is the raw numeric value is used for filtering which is done with a LINQ Where query on the source collection.

Please, read the following articles for more informatio on how filtering work:
Basic Filtering
Programmatic Filtering

I hope this makes sense.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Samuele
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Samuele
Top achievements
Rank 1
MD
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or