loading expander icon in treeview

3 posts, 1 answers
  1. Alex
    Alex avatar
    36 posts
    Member since:
    Sep 2010

    Posted 24 Jan 2011 Link to this post

    Hi. Sometimes when I expand a tree node children won't load and the loading icon to the left of the node keep spinning (see picture attached). Up to now it only happend 3 times, but could you please let me know why it is doing it and if there is a fix?

    Thanks,

    Alex
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 24 Jan 2011 Link to this post

    Hi Alex,

    It is important what you do in your code behind - the LoadOnDemand event handler of the RadTreeView.
    In order to stop the animation, you have to set the IsLoadingOnDemand property to true like so:


    private
    void radTreeView_LoadOnDemand(object sender, RadRoutedEventArgs e)
            {
                // get the treeview
                Telerik.Windows.Controls.RadTreeView tree = sender as Telerik.Windows.Controls.RadTreeView;
                // get the clicked Item
                RadTreeViewItem clickedItem = e.OriginalSource as RadTreeViewItem;
                // add the new items
                RadTreeViewItem newItem = new RadTreeViewItem()
                {
                    Header = "New Item"
                };
                clickedItem.Items.Add(newItem);
                //System.Threading.Thread.Sleep(2000);
                clickedItem.IsLoadingOnDemand = false;
      
            }
    Please let us know if this helps you or not. You can also provide a sample demosntrating your issue s that we could investigate in depth.

    Regards,
    Petar Mladenov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Alex
    Alex avatar
    36 posts
    Member since:
    Sep 2010

    Posted 25 Jan 2011 Link to this post

    I think you reply pointed me in the right direction! I marked it as an answer. I was setting isLoadingOnDemand to false, but I think there was a possibility in my code to skip that step. Should be sorted now though. thanks
Back to Top