Hello,
I created a GridView that shows a List<object>, this "object" could be several types, all these types inherit from a same type. This base type has 3 properties:Key, Value and Icon.
Now I show my XAML
<telerik:RadGridView.Columns> <telerik:GridViewImageColumn Header="" DataMemberBinding="{Binding Icon,Converter={StaticResource IconaParametroConverter}}" IsFilterable="False"/> <telerik:GridViewDataColumn Header="Parametro" DataMemberBinding="{Binding Caption}" Width="Auto"/> <telerik:GridViewDataColumn Header="Valore" DataMemberBinding="{Binding Value,Converter={StaticResource DynamicsParameterConverter}}" Width="*" CellStyle="{StaticResource ValueBoldStyle}" /></telerik:RadGridView.Columns>I attached what it shows at runtime.
The ValueColumn has not the filter control.
The only things is that DataMemberBinding has connected with a Converter because Value property should be several type, but this converter return ever string.
Is it for this reason that not appear a filter control?
This is a converter code (Column of value is not editable)
public class DynamicsParameterConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null) return ""; if (value.GetType() == typeof(DateTime)) { var date = (DateTime) value; return date.ToShortDateString(); } else if (value.GetType() == typeof(int)) { var number = (int) value; return number.ToString(); } else if (value.GetType() == typeof(bool)) { var siNo = (bool) value; return siNo ? "Sì" : "No"; } else if (value.GetType() == typeof(double)) { var valore = (double) value; return string.Format("{0:N2}", valore); } else if (value.GetType() ==typeof(CausaleIVA)) { var valore = (CausaleIVA) value; return string.Format("{0} ({1})", valore.Codice, valore.Descrizione); } else return value.ToString(); } //....}