RadTreeListView - different type children

5 posts, 0 answers
  1. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 14 Jul 2010 Link to this post

    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)
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 15 Jul 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 15 Jul 2010 Link to this post

    I've bound this to a List now and it comes back with the same stacktrace error.
  5. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 15 Jul 2010 Link to this post

    One other note, this only happens when I try to expand a SkuForcast to see the archive.
  6. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 15 Jul 2010 Link to this post

    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.
Back to Top
UI for WPF is Visual Studio 2017 Ready