Hello
Today, I've updated my application with the latest Q3 release (2009.3.1103.1030), I updated my old code as well.
I have a grid that I'm building completely in code behind, by manually adding the gridcolumns (datacolumns, imagecolumns...).
The datatype of each column is set according to the datasource.
Once it's done, I'm setting the itemsource
The weird thing is that, depending on the datasource, it sometimes works.
Second weird thing, when I debug the application on the faulty datasource, no errors shows up, the program runs fine, and everything is correctly displayed.
Here's the error message :
Erreur : Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.InvalidCastException: Le cast spécifié n'est pas valide.
à Telerik.Windows.Controls.GridViewDataColumn.CreateCellElement(GridViewCell cell, Object dataItem)
à Telerik.Windows.Controls.GridView.GridViewCell.CreateCellElement(GridViewColumn column, Object dataItem)
à Telerik.Windows.Controls.GridView.GridViewCell.BuildVisualTree()
à Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement()
à Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
à Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item)
à System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
à System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, IDisposable& generatorState, Int32& childIndex, Size& childSize)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.DetermineRealizedColumnsBlockList(Size constraint)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint)
à System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Any idea why this is happening ?
Today, I've updated my application with the latest Q3 release (2009.3.1103.1030), I updated my old code as well.
I have a grid that I'm building completely in code behind, by manually adding the gridcolumns (datacolumns, imagecolumns...).
The datatype of each column is set according to the datasource.
Once it's done, I'm setting the itemsource
The weird thing is that, depending on the datasource, it sometimes works.
Second weird thing, when I debug the application on the faulty datasource, no errors shows up, the program runs fine, and everything is correctly displayed.
Here's the error message :
Erreur : Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.InvalidCastException: Le cast spécifié n'est pas valide.
à Telerik.Windows.Controls.GridViewDataColumn.CreateCellElement(GridViewCell cell, Object dataItem)
à Telerik.Windows.Controls.GridView.GridViewCell.CreateCellElement(GridViewColumn column, Object dataItem)
à Telerik.Windows.Controls.GridView.GridViewCell.BuildVisualTree()
à Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement()
à Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column)
à Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item)
à System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item)
à System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, IDisposable& generatorState, Int32& childIndex, Size& childSize)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.DetermineRealizedColumnsBlockList(Size constraint)
à Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint)
à System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)
Any idea why this is happening ?