System.NullReferenceException was caught for TreeView and RichTextBox with HtmlDataProvider

4 posts, 0 answers
  1. Pawel
    Pawel avatar
    39 posts
    Member since:
    Apr 2014

    Posted 18 Aug 2014 Link to this post

    I have RadGridView:
    <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Path=Works}" Grid.Column="0"
                            SelectionChanged="RadGridView_SelectionChanged">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" />
        </telerik:RadGridView.Columns
    </telerik:RadGridView>

    with ItemSource bind to Works from MyData class:
    public class MyData
    {
        public ObservableCollection<Work> Works { get; set; }

    and Work is:
    public class Work
    {
        public String Title { get; set; }
     
        public Work(String title)
        {
            Title = title;
        }
     
        public List<Project> Project { get; set; }
    }

    On every SelectionChanged event I pass Project object From Work.Projects to MyData.Projects:
    public class MyData
    {
        public ObservableCollection<Work> Works { get; set; }
     
        public ObservableCollection<Project> Projects { get; set; }

    This Projects ObservableCollection is bind to RadTreeView with enabled virtualization:
    <telerik:RadTreeView IsVirtualizing="True"
                         ItemsSource="{Binding Path=Projects}" Grid.Column="1"
                         ItemTemplate="{StaticResource MyItemTemplate}" />
    with ItemTemplate:
    <DataTemplate x:Key="MyItemTemplate">
        <Grid>
            <telerik:HtmlDataProvider Name="HistoryNoteHtmlDataProvider"
                                        RichTextBox="{Binding ElementName=RtbCommentNoteToRead}"
                                        Html="{Binding Path=Name, Mode=OneWay}" />
            <telerik:RadRichTextBox Name="RtbCommentNoteToRead" />
        </Grid>
    </DataTemplate>

    When I run application I click to first row and in RadTreeView it displays projects. But on second click it thorws exception:
    System.NullReferenceException was caught
      HResult=-2147467261
      Message=Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu.
      Source=PresentationFramework
      StackTrace:
           w System.Windows.Controls.ItemContainerGenerator.Remove(GeneratorPosition position, Int32 count, Boolean isRecycling)
           w System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IRecyclingItemContainerGenerator.Recycle(GeneratorPosition position, Int32 count)
           w Telerik.Windows.Controls.TreeView.TreeViewPanel.CleanupRange(IList children, IItemContainerGenerator generator, Int32 startIndex, Int32 count)
           w Telerik.Windows.Controls.TreeView.TreeViewPanel.CleanupContainers(Int32 firstViewport, ItemsControl itemsControl)
           w Telerik.Windows.Controls.TreeView.TreeViewPanel.MeasureOverride(Size constraint)
           w System.Windows.FrameworkElement.MeasureCore(Size availableSize)
           w System.Windows.UIElement.Measure(Size availableSize)
           w System.Windows.ContextLayoutManager.UpdateLayout()
           w System.Windows.UIElement.UpdateLayout()
           w Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.UpdateEditorLayout()
           w Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.DoOnDocumentChanged()
           w Telerik.Windows.Documents.UI.DocumentPresenterBase.OnOwnerChanged()
           w Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.OnOwnerChanged()
           w Telerik.Windows.Documents.UI.DocumentPresenterBase.set_Owner(RadRichTextBox value)
           w Telerik.Windows.Controls.RadRichTextBox.InitActiveEditorPresenter(Boolean clearTextRelatedObjectPools)
           w Telerik.Windows.Controls.RadRichTextBox.set_Document(RadDocument value)
           w Telerik.Windows.Documents.FormatProviders.DataProviderBase.UpdateDocument()
           w Telerik.Windows.Documents.FormatProviders.DataProviderBase.StringPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
           w System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
           w System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
           w System.Windows.Data.BindingExpression.Activate(Object item)
           w System.Windows.Data.BindingExpression.OnDataContextChanged(DependencyObject contextElement)
           w System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
           w System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
           w System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
           w System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.TreeWalkHelper.OnInheritablePropertyChanged(DependencyObject d, InheritablePropertyChangeInfo info, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
           w System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
           w System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
           w System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
           w System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
           w System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
           w System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
           w System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
           w System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
           w System.Windows.Controls.ContentPresenter.OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
           w System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList`1& dependents, Boolean invalidateOnlyContainer)
           w System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex)
           w System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
           w System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
           w System.Windows.Controls.ContentControl.set_Content(Object value)
           w Telerik.Windows.Controls.RadTreeViewItem.UpdateHeaderPresenterContent()
           w Telerik.Windows.Controls.RadTreeViewItem.OnHeaderChanged(Object oldHeader, Object newHeader)
           w System.Windows.Controls.HeaderedItemsControl.OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
           w System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
           w System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
           w System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
           w System.Windows.DependencyObject.ClearValue(DependencyProperty dp)
           w Telerik.Windows.Controls.RadTreeView.ClearDependencyProperties(RadTreeViewItem treeViewItem, Object item)
           w Telerik.Windows.Controls.RadTreeView.ClearContainerForDescendant(DependencyObject element, Object item)
           w Telerik.Windows.Controls.RadTreeView.ClearContainerForItemOverride(DependencyObject element, Object item)
           w System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.ClearContainerForItem(DependencyObject container, Object item)
           w System.Windows.Controls.ItemContainerGenerator.UnlinkContainerFromItem(DependencyObject container, Object item, IGeneratorHost host)
           w System.Windows.Controls.ItemContainerGenerator.RemoveAllInternal(Boolean saveRecycleQueue)
           w System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.RemoveAll()
           w System.Windows.Controls.ItemContainerGenerator.OnRefresh()
           w System.Windows.Controls.ItemContainerGenerator.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
           w System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
           w System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
           w System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
           w System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
           w System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
           w System.Windows.Controls.ItemCollection.OnViewCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
           w System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
           w System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
           w System.Collections.Specialized.CollectionChangedEventManager.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
           w System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
           w System.Windows.Data.ListCollectionView.RefreshOverride()
           w System.Windows.Data.CollectionView.RefreshInternal()
           w System.Windows.Data.CollectionView.RefreshOrDefer()
           w System.Windows.Data.ListCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args)
           w System.Windows.Data.CollectionView.OnCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args)
           w System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
           w System.Collections.ObjectModel.ObservableCollection`1.ClearItems()
           w System.Collections.ObjectModel.Collection`1.Clear()
           w TestTelerikWpfApp.MainWindow.RadGridView_SelectionChanged(Object sender, SelectionChangeEventArgs e) w d:\Users\ppiechnik\Documents\Visual Studio 2012\Projects\TestTelerikWpfApp\TestTelerikWpfApp\MainWindow.xaml.cs:wiersz 34
      InnerException:

    Disabling virtualization makes no occurrence of this exception.

  2. Pawel
    Pawel avatar
    39 posts
    Member since:
    Apr 2014

    Posted 18 Aug 2014 Link to this post

    I paste all code just in case:

    MainWindow.xaml:
    <Window x:Class="TestTelerikWpfApp.MainWindow"
            xmlns:sampleDat="clr-namespace:TestTelerikWpfApp"
            Title="MainWindow" Height="300">
        <Window.Resources>
            <DataTemplate x:Key="MyItemTemplate">
                <Grid>
                    <telerik:HtmlDataProvider Name="HistoryNoteHtmlDataProvider"
                                        RichTextBox="{Binding ElementName=RtbCommentNoteToRead}"
                                        Html="{Binding Path=Name, Mode=OneWay}" />
                    <telerik:RadRichTextBox Name="RtbCommentNoteToRead" />
                </Grid>
            </DataTemplate>
        </Window.Resources>
     
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="300" />
            </Grid.ColumnDefinitions>
     
            <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding Path=Works}" Grid.Column="0"
                            SelectionChanged="RadGridView_SelectionChanged">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding Title}" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
     
            <telerik:RadTreeView IsVirtualizing="True"
                         ItemsSource="{Binding Path=Projects}" Grid.Column="1"
                         ItemTemplate="{StaticResource MyItemTemplate}" />
        </Grid>
    </Window>

    MainWindow.xaml.cs:
    using System;
    using System.Linq;
    using System.Windows;
    using Telerik.Windows.Controls;
     
    namespace TestTelerikWpfApp
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
     
                DataContext = new MyData();
            }
     
            private void RadGridView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
            {
                try
                {
                    (DataContext as MyData).Projects.Clear();
     
                    ((sender as RadGridView).SelectedItem as Work).Project.ToList().ForEach((project) =>
                    {
                        (DataContext as MyData).Projects.Add(project);
                    });
                }
                catch (Exception exception)
                {
                    // System.NullReferenceException was caught here
                }
            }
        }
    }

    MyData.cs:
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
     
    namespace TestTelerikWpfApp
    {
        public class MyData
        {
            public ObservableCollection<Work> Works { get; set; }
     
            public ObservableCollection<Project> Projects { get; set; }
     
     
            public MyData()
            {
                InitializeWorks();
     
                Projects = new ObservableCollection<Project>();
            }
     
            public void InitializeWorks()
            {
                String workTitle = String.Empty;
     
                Works = new ObservableCollection<Work>();
     
                workTitle = "Work 1";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 2";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 3";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 4";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 5";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 6";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 7";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
                workTitle = "Work 8";
                Works.Add(new Work(workTitle)
                {
                    Project = new List<Project>(new Project[] {
                    new Project(workTitle + " - Project 1") ,
                    new Project(workTitle + " - Project 2") ,
                    new Project(workTitle + " - Project 3") ,
                    new Project(workTitle + " - Project 4") ,
                    new Project(workTitle + " - Project 5") ,
                    new Project(workTitle + " - Project 6") ,
                    new Project(workTitle + " - Project 7") ,
                    new Project(workTitle + " - Project 8") ,
                    new Project(workTitle + " - Project 9") ,
                    new Project(workTitle + " - Project 10"),
                    new Project(workTitle + " - Project 11") ,
                    new Project(workTitle + " - Project 12") ,
                    new Project(workTitle + " - Project 13") ,
                    new Project(workTitle + " - Project 14") ,
                    new Project(workTitle + " - Project 15") ,
                    new Project(workTitle + " - Project 16") ,
                    new Project(workTitle + " - Project 17") ,
                    new Project(workTitle + " - Project 18") ,
                    new Project(workTitle + " - Project 19") ,
                    new Project(workTitle + " - Project 20")
                })
                });
            }
     
        }
    }

    Project.cs:
    using System;
     
    namespace TestTelerikWpfApp
    {
        public class Project
        {
            public String Name { get; set; }
     
            public Project(String name)
            {
                Name = name;
            }
        }
    }

    Work.cs:
    using System;
    using System.Collections.Generic;
     
    namespace TestTelerikWpfApp
    {
        public class Work
        {
            public String Title { get; set; }
     
            public Work(String title)
            {
                Title = title;
            }
     
            public List<Project> Project { get; set; }
        }
    }
  3. UI for WPF is Visual Studio 2017 Ready
  4. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 19 Aug 2014 Link to this post

    Hi Pawel,

    We managed to reproduce this exception. It is in our Recycling virtualization logic in RadTreeView and we logged it in our FeedBack portal where you can track its status. We also updated your telerik account points as a thanks for your cooperation.
    As a workaround, you can use the HierarchicalVirtualization mode. If your tree structure is not too deep or complex, you won't feel any performance degradation.
    <telerik:RadTreeView  telerik:TreeViewPanel.TreeVirtualizationMode="Hierarchical"


    Regards,
    Petar Mladenov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Pawel
    Pawel avatar
    39 posts
    Member since:
    Apr 2014

    Posted 20 Aug 2014 Link to this post

    Thank you.
Back to Top