Hi Telerik guys,
Thanks for providing a great control like Silverlight Telerik.
I am highly interested in its Load-on-demand feature but unfortunately it is not working in my application.
Please find the code I am using.
XAML
<telerikCore:HierarchicalDataTemplate x:Key="Emp" ItemsSource="{Binding Subordinates}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="12" />
<TextBlock Text="{Binding Age}" FontWeight="Bold" FontSize="12" />
</StackPanel>
</telerikCore:HierarchicalDataTemplate>
<telerikNavigation:RadTreeView Width="290" HorizontalAlignment="Left" x:Name="tree"
VerticalAlignment="Top" IsLoadOnDemandEnabled="True" ItemTemplate="{StaticResource Emp}"
LoadOnDemand="tree_LoadOnDemand" />
Code snippet
public class Emp
{
public string Name { get; set; }
public int Age { get; set; }
public ObservableCollection<Emp> Subordinates { get; set; }
}
void tree_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadTreeViewItem item = e.OriginalSource as RadTreeViewItem;
Emp emp = item.Item as Emp;
if (emp != null)
{
emp.Subordinates = new ObservableCollection<Emp>();
emp.Subordinates.Add(new Emp() { Name = "Runtimeload", Age = 46 });
}
else
item.IsLoadOnDemandEnabled = false;
}
I checked by debugging. The LoadOnDemand event does get fired when I click the expander button in treeview. But still no new child nodes appear. It just keeps showing the default animation infinitely.
I downloaded a similar demo application and its load on demand is also not working - however event does get triggered. I am banging my head against wall for this simple problem. There is not much of code and I wonder what I am doing wrong. In your example solution, the load on demand works as expected.
Please respond as early as possible. Let me know if you need full source code. This bug/problem has become the blocking feature in my project and we are nearing the release.
Regards,
Murtaza
Thanks for providing a great control like Silverlight Telerik.
I am highly interested in its Load-on-demand feature but unfortunately it is not working in my application.
Please find the code I am using.
XAML
<telerikCore:HierarchicalDataTemplate x:Key="Emp" ItemsSource="{Binding Subordinates}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="12" />
<TextBlock Text="{Binding Age}" FontWeight="Bold" FontSize="12" />
</StackPanel>
</telerikCore:HierarchicalDataTemplate>
<telerikNavigation:RadTreeView Width="290" HorizontalAlignment="Left" x:Name="tree"
VerticalAlignment="Top" IsLoadOnDemandEnabled="True" ItemTemplate="{StaticResource Emp}"
LoadOnDemand="tree_LoadOnDemand" />
Code snippet
public class Emp
{
public string Name { get; set; }
public int Age { get; set; }
public ObservableCollection<Emp> Subordinates { get; set; }
}
void tree_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadTreeViewItem item = e.OriginalSource as RadTreeViewItem;
Emp emp = item.Item as Emp;
if (emp != null)
{
emp.Subordinates = new ObservableCollection<Emp>();
emp.Subordinates.Add(new Emp() { Name = "Runtimeload", Age = 46 });
}
else
item.IsLoadOnDemandEnabled = false;
}
I checked by debugging. The LoadOnDemand event does get fired when I click the expander button in treeview. But still no new child nodes appear. It just keeps showing the default animation infinitely.
I downloaded a similar demo application and its load on demand is also not working - however event does get triggered. I am banging my head against wall for this simple problem. There is not much of code and I wonder what I am doing wrong. In your example solution, the load on demand works as expected.
Please respond as early as possible. Let me know if you need full source code. This bug/problem has become the blocking feature in my project and we are nearing the release.
Regards,
Murtaza