Hi All
I have bound the ItemSource of the RadBook to an ObservableCollection of classes, then I am using the item template to create a user control that binds it DataContext to the object. This is working well. I found however that I need to ensure that all the UserControls are loaded as soon as the ItemSource of the RadBook is Updated. Right now they only load when you navigate to that page.
Is there any method that I can call that does not require me to cause the book to iterate through all the pages?
Thanks for you help
Nick
I have bound the ItemSource of the RadBook to an ObservableCollection of classes, then I am using the item template to create a user control that binds it DataContext to the object. This is working well. I found however that I need to ensure that all the UserControls are loaded as soon as the ItemSource of the RadBook is Updated. Right now they only load when you navigate to that page.
Is there any method that I can call that does not require me to cause the book to iterate through all the pages?
Thanks for you help
Nick
3 Answers, 1 is accepted
0
Hi Nick,
Vlad
the Telerik team
If you do this you may get highly unresponsive application. How many pages you have?
Kind regards,Vlad
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
0

Nick Wood
Top achievements
Rank 1
answered on 17 Jun 2010, 08:00 AM
Hi Vlad
There is never usually any more that 10 items (on average there would only be about 5).
So is there any way to ensure all elements/pages are loaded without iterating the items?
Thanks
Nick
There is never usually any more that 10 items (on average there would only be about 5).
So is there any way to ensure all elements/pages are loaded without iterating the items?
Thanks
Nick
0
Hi Nick,
With our Beta release (0609) we added a new property to RadBook called IsVirtualizing. This property turns off RadBook's UI virtualization (i.e reuse old book item containers). Let me explain how the IsVirtualizing property works in order for you to determine whether it is going to help.
Imagine the following scenario. You have a UserControl that contains just a single TextBlock whose Text property is bound to the Title property of your business object:
In the DataTemplate of RadBook, you use this user control:
Finally you populate RadBook with a collection of 10 items:
Now, if you attach to the loaded event of UserControl1...
...and run the application, you will see the Loaded message displayed 2 times. Turn to the next page and the message will be displayed 2 more times. When you reach the last page, the Loaded message should be displayed 10 times (the total number of items in the collection).
Now, if you start going back to the first page, the Loaded message will not be displayed any more, since IsVirtualizing has been set to False and all the containers have been generated. If IsVirtualizing was set to True then once you start going back to the first page, the Loaded message will get displayed.
Currently there is no way to generate all the containers once the ItemsSource is set. You have to turn all the pages at least once for all the containers to get generated.
Play around with the IsVirtualizing property and let me know if it will do the job. Let me know how I can be of further assistance.
On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverilght applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx
Kind regards,
Kiril Stanoev
the Telerik team
With our Beta release (0609) we added a new property to RadBook called IsVirtualizing. This property turns off RadBook's UI virtualization (i.e reuse old book item containers). Let me explain how the IsVirtualizing property works in order for you to determine whether it is going to help.
Imagine the following scenario. You have a UserControl that contains just a single TextBlock whose Text property is bound to the Title property of your business object:
<
UserControl
x:Class
=
"WpfApplication3.UserControl1"
xmlns:x
=
"http://schemas.microsoft.com/winfx/2006/xaml"
>
<
Grid
>
<
TextBlock
Text
=
"{Binding Title}"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
FontSize
=
"36"
/>
</
Grid
>
</
UserControl
>
In the DataTemplate of RadBook, you use this user control:
<
Window
x:Class
=
"WpfApplication3.Window1"
xmlns:local
=
"clr-namespace:WpfApplication3"
xmlns:telerik
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
xmlns:telerikNavigation
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
Title
=
"Window1"
>
<
Window.Resources
>
<
DataTemplate
x:Key
=
"PageTemplate"
>
<
Border
BorderThickness
=
"1"
BorderBrush
=
"Black"
Background
=
"LightGoldenrodYellow"
>
<
local:UserControl1
/>
</
Border
>
</
DataTemplate
>
</
Window.Resources
>
<
Grid
>
<
telerikNavigation:RadBook
x:Name
=
"book1"
Width
=
"500"
Height
=
"500"
LeftPageTemplate
=
"{StaticResource PageTemplate}"
RightPageTemplate
=
"{StaticResource PageTemplate}"
IsVirtualizing
=
"False"
/>
</
Grid
>
</
Window
>
Finally you populate RadBook with a collection of 10 items:
public
partial
class
Window1 : Window
{
public
Window1()
{
InitializeComponent();
// Create a collection of 10 items that will server as RadBook's ItemsSource
book1.ItemsSource = Enumerable.Range(0, 10).
Select(i =>
new
DataItem()
{
Title =
string
.Format(
"Item {0}"
, i)
});
}
}
public
class
DataItem
{
public
string
Title {
get
;
set
; }
}
Now, if you attach to the loaded event of UserControl1...
public
UserControl1()
{
InitializeComponent();
this
.Loaded +=
new
RoutedEventHandler(UserControl1_Loaded);
}
void
UserControl1_Loaded(
object
sender, RoutedEventArgs e)
{
Debug.WriteLine(
"Loaded"
);
}
...and run the application, you will see the Loaded message displayed 2 times. Turn to the next page and the message will be displayed 2 more times. When you reach the last page, the Loaded message should be displayed 10 times (the total number of items in the collection).
Now, if you start going back to the first page, the Loaded message will not be displayed any more, since IsVirtualizing has been set to False and all the containers have been generated. If IsVirtualizing was set to True then once you start going back to the first page, the Loaded message will get displayed.
Currently there is no way to generate all the containers once the ItemsSource is set. You have to turn all the pages at least once for all the containers to get generated.
Play around with the IsVirtualizing property and let me know if it will do the job. Let me know how I can be of further assistance.
On a side note, I'd like to inform you that we've just released an online tool that allows you to reduce the size of your Silverilght applications. For more information, please visit http://blogs.telerik.com/blogs/posts/10-06-10/telerik_assembly_minifier.aspx
Kind 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