OnDataBound Event

2 posts, 0 answers
  1. Rupendra
    Rupendra avatar
    8 posts
    Member since:
    May 2011

    Posted 15 Jun 2011 Link to this post

    I need to display a busy indicator on my page untill the data has completely loaded and is displayed on the radtreeview. Is there an event that tells me that the tree has completly loaded data. The Loaded event fires as soon as the tree as a control is ready and is not associated to the data.

    I have set the IsLoadOnDemandEnabled property to true and manually Setting the ItemSource property to an observable collection. However, I cannot use this point in time as when my data is visible to the user since it takes some extra time to bind it to the visual tree. Hence I have a need for an OnDataBound event from the tree control.
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 20 Jun 2011 Link to this post

    Hi Rupendra,

    Unfortunately, there is no such event available in Silverlight. One possibility I can think of is to subscribe to the StatusChanged event of RadTreeView or RadTreeViewItem's ItemContainerGenerator.
    <telerik:RadTreeView IsVirtualizing="True">
        <telerik:RadTreeViewItem Header="Root" x:Name="root" LoadOnDemand="root_LoadOnDemand"
                IsLoadOnDemandEnabled="True" />
    </telerik:RadTreeView>



    public MainPage()
    {
        InitializeComponent();
     
        // Listen for StatusChanged of the ItemContainerGenerator
        this.root.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged);
    }
     
    void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
    {
        if(this.root.ItemContainerGenerator.Status == Telerik.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
        {
            // Containers have finished generating.
        }
    }
     
    private void root_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)
    {
        // Populate with data
        this.root.ItemsSource = Enumerable.Range(0, 200);
        this.root.IsLoadingOnDemand = false;
    }

    However, let me ask why do you need such an event. If you virtualize the RadTreeView, the expand operation will be almost immediate with little or nor performance hit. I'd be glad if you can share more information about your scenario.

    Regards,
    Kiril Stanoev
    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. DevCraft banner
Back to Top