This is a migrated thread and some comments may be shown as answers.

OnDataBound Event

1 Answer 76 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rupendra
Top achievements
Rank 1
Rupendra asked on 15 Jun 2011, 10:09 PM
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.

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 20 Jun 2011, 07:15 PM
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
Tags
TreeView
Asked by
Rupendra
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or