Hi,
I think we are seeing a problem with Exporting when the class in the collection that the RadGridView binds to has a sub class, and one of the properties of that sub class has a converter on it. This is an example (Sub Item B is causing the trouble):
And this is the code:
In the Export, the converter is not applied, and the output logging of VS contains this:
System.Windows.Data Error: 40 : BindingExpression path error: 'SubItem' property not found on 'object' ''ExportElement' (HashCode=6)'. BindingExpression:Path=SubItem.SubItemA; DataItem='ExportElement' (HashCode=6); target element is 'ValueSetter' (Name=''); target property is 'Value' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'SubItem' property not found on 'object' ''ExportElement' (HashCode=6)'. BindingExpression:Path=SubItem.SubItemB; DataItem='ExportElement' (HashCode=6); target element is 'ValueSetter' (Name=''); target property is 'Value' (type 'Object')
Product version 2013.3.1016.40, VS2010 SP1, Windows 7 x64.
Any ideas?
I think we are seeing a problem with Exporting when the class in the collection that the RadGridView binds to has a sub class, and one of the properties of that sub class has a converter on it. This is an example (Sub Item B is causing the trouble):
<telerik:RadGridView x:Name="testRadGridView" ItemsSource="{Binding ItemList}" AutoGenerateColumns="False"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=MainItemA}" Header="Main Item A " /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=MainItemB}" Header="Main Item B " /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=SubItem.SubItemA}" Header="Sub Item A" /> <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=SubItem.SubItemB, Converter={StaticResource MyTestConverter}}" Header="Sub Item B" /> </telerik:RadGridView.Columns></telerik:RadGridView>And this is the code:
public class Item { public string MainItemA { get; set; } public int MainItemB { get; set; } public SubItem SubItem { get; set; } }
public class SubItem { public string SubItemA { get; set; } public DateTime SubItemB { get; set; } }
public class TestConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { DateTime dateTimeValue = (DateTime)value; return dateTimeValue.ToString("yyyy-MM-dd HH:mm:ss"); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotSupportedException(); } } public class MainWindowViewModel { public ObservableCollection<Item> ItemList { get; set; } public MainWindowViewModel() { ItemList = new ObservableCollection<Item>(); ItemList.Add(new Item { MainItemA = "Main Item A1", MainItemB = 1, SubItem = new SubItem { SubItemA = "Sub Item A1", SubItemB = new DateTime(2014,1,1,13,12,11) } }); ItemList.Add(new Item { MainItemA = "Main Item A2", MainItemB = 2, SubItem = new SubItem { SubItemA = "Sub Item A2", SubItemB = new DateTime(1999, 4, 3, 2, 1, 0) } }); } }In the Export, the converter is not applied, and the output logging of VS contains this:
System.Windows.Data Error: 40 : BindingExpression path error: 'SubItem' property not found on 'object' ''ExportElement' (HashCode=6)'. BindingExpression:Path=SubItem.SubItemA; DataItem='ExportElement' (HashCode=6); target element is 'ValueSetter' (Name=''); target property is 'Value' (type 'Object')
System.Windows.Data Error: 40 : BindingExpression path error: 'SubItem' property not found on 'object' ''ExportElement' (HashCode=6)'. BindingExpression:Path=SubItem.SubItemB; DataItem='ExportElement' (HashCode=6); target element is 'ValueSetter' (Name=''); target property is 'Value' (type 'Object')
Product version 2013.3.1016.40, VS2010 SP1, Windows 7 x64.
Any ideas?