RadTreeView Virtualizing then TreeViewItem header disappear

7 posts, 1 answers
  1. Michael
    Michael avatar
    2 posts
    Member since:
    Mar 2011

    Posted 14 Mar 2011 Link to this post

    I'm not sure whether this is a bug or something I haven't done correctly. I have the following very simple codes in an XBap:

        <Telerik:RadTreeView IsVirtualizing="True">
          <Telerik:RadTreeViewItem Header="Parent Node">
            <Telerik:RadTreeViewItem Header="Child Node">
              <Telerik:RadTreeViewItem Header="Grandchild Node">
                <Telerik:RadTreeViewItem Header="No idea"></Telerik:RadTreeViewItem>
                </Telerik:RadTreeViewItem>
              </Telerik:RadTreeViewItem>
          </Telerik:RadTreeViewItem>
        </Telerik:RadTreeView>

    Please do notice that I set IsVirtualizing to True. If I run it then expand, then collapse a TreeViewItem a few times, the child TreeViewItem header disappear.

    My test application is an XBap with Visual Studio 2010 and .Net 4.

    Edited: I know the title of the post sounds really weird. I tried to change but there seems to be no way to do that.
    Much appreciate for all your help.
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 17 Mar 2011 Link to this post

    Hi Michael,

    This is a known issue and it is logged in our PITS where you can track its progress.

    Please accept our apology for the caused inconvenience.

    Regards,
    Tina Stancheva
    the Telerik team
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    2 posts
    Member since:
    Mar 2011

    Posted 17 Mar 2011 Link to this post

    Many thanks for your reply. I will use ListBox instead of the TreeView then cause the .Net TreeView also has bugs when turn on virtualization.

    Apart from this bug, Telerik controls are great really. We r considering buying them for our project. Cheers
  5. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jul 2012

    Posted 30 Jul 2014 Link to this post

    Exact bug is happening to me now - any ideas how to fix it?
  6. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 31 Jul 2014 Link to this post

    Hello Brandon,

    Please note that the UIVirtualization of the RadTreeView control is designed to work in data binding scenarios. If you declare the control with its items in XAML you actually create UIContainers hence the UIVirtualization does not take place.

    In other words the RadTreeView control does not support virtualization when using XAML items.

    Regards,
    Pavel R. Pavlov
    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.
     
  7. Brandon
    Brandon avatar
    4 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2014 in reply to Pavel R. Pavlov Link to this post

    This happens using data source. Unfortunately I can't attach a project for you. So here is my xaml:

    <Window
            xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="WpfApplication3.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
     
            <telerik:RadTreeView x:Name="m_tree" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsVirtualizing="True" LoadOnDemand="m_tree_LoadOnDemand">
            </telerik:RadTreeView>
     
        </Grid>
    </Window>


    And here is MainWindow.xaml.cs



    public partial class MainWindow : Window
    {
       public MainWindow()
       {
          InitializeComponent();
     
          string[] items = new string[]
          {
             "Hello",
             "There",
          };
     
          m_tree.ItemsSource = items.Select(s => new Telerik.Windows.Controls.RadTreeViewItem() { Header = s, IsLoadOnDemandEnabled = true });
       }
     
       private void m_tree_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)
       {
          (e.OriginalSource as Telerik.Windows.Controls.RadTreeViewItem).Items.Add(new Telerik.Windows.Controls.RadTreeViewItem() { Header = "one" });
          (e.OriginalSource as Telerik.Windows.Controls.RadTreeViewItem).Items.Add(new Telerik.Windows.Controls.RadTreeViewItem() { Header = "two" });
          (e.OriginalSource as Telerik.Windows.Controls.RadTreeViewItem).IsLoadingOnDemand = false;
       }





  8. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 04 Aug 2014 Link to this post

    Hello Brandon,

    I can see in the provided snippets that you actually create UI containers (e.g. RadTreeViewItem). This is the reason why the virtualization cannot take place in your particular scenario. You should create business items and let the control decide when the UI containers should be created.

    You can find a sample demonstration how the LoadOnDemand feature can be used with virtualization in our documentation. Please give this approach a try and let us know if you need any further assistance. 

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