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