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

RadTreeListView - different type children

4 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
David Brenchley
Top achievements
Rank 1
David Brenchley asked on 15 Jul 2010, 12:24 AM
I don't see a RadTreeListView forum yet, so I'm sticking this here.

I have a list of objects of type SkuForecast.  Each SkuForecast has a list of objects of type SkuForecastArchive which has the same columns as the SkuForecast.
I'm trying to setup the RadTreeListView control to work with them, but I'm getting an InvalidCastException error cannot cast type SkuForecastArchive to type SkuForecast

What am I doing wrong?
                <telerik:RadTreeListView Name="telerikGrid" FrozenColumnCount="10" CanUserResizeColumns="True" IsFilteringAllowed="False"
 AutoGenerateColumns="False" CanUserFreezeColumns="True" 
 ScrollMode="RealTime" EnableColumnVirtualization="False" EnableRowVirtualization="True"
                 RowIndicatorVisibility="Collapsed"
                 HierarchyColumnIndex="2"  
 RowStyle="{DynamicResource GridViewRowStyle1}" 
 ItemsSource="{Binding PagedSource, ElementName=dataPager}"
 EditTriggers="CellClick"
 ShowGroupPanel="False">
...
           
<telerik:RadTreeListView.ChildTableDefinitions>
                        <telerik:TreeListViewTableDefinition ItemsSource="{Binding SkuForecastArchiveData}"/>
                    </telerik:RadTreeListView.ChildTableDefinitions>
...
         
            <telerik:RadTreeListView.Columns>

                  <telerik:GridViewDataColumn DataMemberBinding="{Binding Sku}" Header="Sku"  Width="48"/>
                  <telerik:GridViewDataColumn Name="skuDescColumn" DataMemberBinding="{Binding SkuShortDesc}" Header="Desc" Width="250"/>
                  <telerik:GridViewDataColumn Name="CapacityColumn" DataMemberBinding="{Binding Capacity}" Header="Capacity" Width="53"/>
...


   at Telerik.Windows.Data.FuncExtensions.<>c__DisplayClass1`2.<ToUntypedFunc>b__0(Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Core\Data\Extensions\FuncExtensions.cs:line 19
   at Telerik.Windows.Controls.GridViewBoundColumnBase.GetCellContent(Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Columns\GridViewBoundColumnBase.cs:line 796
   at Telerik.Windows.Controls.GridViewBoundColumnBase.CreateCellElement(GridViewCell cell, Object dataItem) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Columns\GridViewBoundColumnBase.cs:line 71
   at Telerik.Windows.Controls.GridView.GridViewCell.CreateCellElement(GridViewColumn column, Object dataItem) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 480
   at Telerik.Windows.Controls.GridView.GridViewCell.SetCellElement() in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 450
   at Telerik.Windows.Controls.GridView.GridViewRow.PrepareCell(GridViewCellBase cellBase, GridViewColumn column) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRow.cs:line 540
   at Telerik.Windows.Controls.GridView.DataCellsPresenter.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 257
   at Telerik.Windows.Controls.GridView.DataCellsPresenter.OnItemChanged(Object oldItem, Object newItem) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 328
   at Telerik.Windows.Controls.GridView.DataCellsPresenter.set_Item(Object value) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\DataCellsPresenter.cs:line 296
   at Telerik.Windows.Controls.GridView.GridViewRowItem.OnItemChanged(Object oldItem, Object newItem) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRowItem.cs:line 433
   at Telerik.Windows.Controls.GridView.GridViewRow.OnItemChanged(Object oldItem, Object newItem) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRow.cs:line 432
   at Telerik.Windows.Controls.RadRowItem.OnItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Core\Data\RadRowItem.cs:line 47
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Telerik.Windows.Controls.RadRowItem.set_Item(Object value) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Core\Data\RadRowItem.cs:line 34
   at Telerik.Windows.Controls.GridView.GridViewRowItem.PrepareRow(Object item, GridViewDataControl owningDataGrid) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRowItem.cs:line 475
   at Telerik.Windows.Controls.GridView.GridViewRow.PrepareRow(Object item, GridViewDataControl owningDataGrid) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Rows\GridViewRow.cs:line 414
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 7645
   at Telerik.Windows.Controls.RadTreeListView.PrepareContainerForItemOverride(DependencyObject element, Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\TreeListView\RadTreeListView.cs:line 176
   at Telerik.Windows.Controls.GridView.BaseItemsControl.Telerik.Windows.Controls.GridView.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\ItemsControl\BaseItemsControl.cs:line 330
   at Telerik.Windows.Controls.GridView.GridViewItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\ItemsControl\GridViewItemContainerGenerator.cs:line 261
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 2073
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.InsertRecycledContainer(Int32 childIndex, UIElement container) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 1985
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 2112
   at Telerik.Windows.Controls.GridView.GridViewVirtualizingPanel.MeasureOverride(Size constraint) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2\Sources\Development\Controls\GridView\GridView\GridView\Virtualization\GridViewVirtualizingPanel.cs:line 1217
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 15 Jul 2010, 07:28 AM
Hello David Brenchley,

We will create a forum for RadTreeListView for WPF, thank you for notifying us.

What happens if you remove the datapager from the window and bind the treelistview to the List of SkuForecast?

Kind regards,
Veskoni
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
David Brenchley
Top achievements
Rank 1
answered on 15 Jul 2010, 03:53 PM
I've bound this to a List now and it comes back with the same stacktrace error.
0
David Brenchley
Top achievements
Rank 1
answered on 15 Jul 2010, 03:54 PM
One other note, this only happens when I try to expand a SkuForcast to see the archive.
0
David Brenchley
Top achievements
Rank 1
answered on 15 Jul 2010, 04:46 PM
Ok, I've stripped out all but 2 of my columns and it is working now.  So it must be something in my code.  I'll start adding columns and see where it breaks.  Thanks for your help.
Tags
GridView
Asked by
David Brenchley
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
David Brenchley
Top achievements
Rank 1
Share this question
or