Few questions about IsLoadOnDemandEnabled

5 posts, 0 answers
  1. Lauren Nickerson
    Lauren Nickerson avatar
    52 posts
    Member since:
    Jul 2009

    Posted 04 Aug 2010 Link to this post

    First question:

    Is it possible to have IsLoadOnDemand = true but NOT show the arrows on some items? (The arrows that indicate the items have items themselves). Not all our items have children, so we don't want to show the arrows in all of the items.

    http://www.screencast.com/users/CarloToribio/folders/Jing/media/abe8d5f6-a1f0-4776-9812-b709f3ff4c97

    Second question:

    How can I make the items show the loading animation while I'm doing something in the LoadOnDemand event? We're trying to deserialize some objects in there, and it might take a second or two, but the animation doesn't show up, it just freezes for those two seconds. I tried it this way but no luck:

    private void treeView_LoadOnDemand(object sender, RadRoutedEventArgs e)
    {
        RadTreeViewItem clickedItem = e.Source as RadTreeViewItem;
     
        clickedItem.Dispatcher.BeginInvoke(new ThreadStart(delegate
            {
                clickedItem.Items.Add(new RadTreeViewItem() { Header = clickedItem.Header + "." + (clickedItem.Items.Count + 1) });
     
                Thread.Sleep(2000);
            }));
    }

    Any suggestions?

    Thanks.

    Thanks.
  2. Sushil
    Sushil avatar
    5 posts
    Member since:
    Apr 2009

    Posted 06 Aug 2010 Link to this post

    Hi,

    I am having similar problem with the arrows.

    Looking forward to any suggestions...

    Thanks,
  3. UI for WPF is Visual Studio 2017 Ready
  4. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 10 Aug 2010 Link to this post

    Hi Lauren & Sushil,

    You can turn off the arrows by setting the IsLoadOnDemandEnabled = false for a given item.

    A good place to do this is the ItemPrepared event since there you have both the item and the business object. Of course you need to have a property that indicates whether the object has children.

    When the user clicks the arrow, a spinning circle animation does appear. In your case it may not be visible because the deserialization happens on the UI (main) thread. The solution here is to dispatch the time-consuming operations to a different thread since no controls can be updated while the ui thread is busy with something else.

    Greetings,
    Miroslav
    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
  5. Sushil
    Sushil avatar
    5 posts
    Member since:
    Apr 2009

    Posted 20 Sep 2010 Link to this post

    Hi Miroslav,

    In my application,
    1. LoadOnDemand is true
    2. IsLoadOnDemandEnabled has binding to view model property called 'HasChildren'.

    e.g. Tree:

    Root
       | - a
       | - b
       | - c

    When i was loading children for Root, i check if 'b' has any children. Say 'b' has children, so i set b's 'hasChidlren' = true.
    I double checked in 'ItemPrepared' event to see if 'b' has IsLoadOnDemandEnabled = true.

    I still don't see the arrow for 'b'. ( Mostly)

    Note: Some times when I stop for breakpoints and then hit continue, i see the arrow. The arrow visibility is random.

    EDIT: Just noticed, If i collapse and expand the Root node, the arrow for 'b' becomes visible.

    Any suggestions ?

    Thanks.

  6. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 23 Sep 2010 Link to this post

    Hello Sushil,

    Accept our apologize for the late reply. Could you please send me your sample project, because I am not able to reproduce your problem?

    Kind regards,
    Viktor Tsvetkov
    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
Back to Top
UI for WPF is Visual Studio 2017 Ready