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

Chapters and bindings

4 Answers 82 Views
Book
This is a migrated thread and some comments may be shown as answers.
prog1
Top achievements
Rank 1
prog1 asked on 03 Aug 2010, 02:30 PM
Is there a way to add chapters to the RadBook? A workaround would be a RadTab with RadBooks for each chapter.
Is this the recommanded way?

If I want to bind the RadBook to a list of objects, is it possible that ervery object is represented by 2 RadBookItems (left & right page).
Do you have examples for binding and RadBook? Not tried, yet.

What I like to get is something like This:

RadBook - Product catalog
Chapter - product categories (The first 2 pages of a Chapter should describe the categorie, binding categories)
2 Sites - product (Binding on the product collection of categorie).

4 Answers, 1 is accepted

Sort by
0
Miroslav
Telerik team
answered on 06 Aug 2010, 11:28 AM
Hello Fabian Höger,

The RadBook can only be bound to a flat collection of items. If you want a hierarchy, then indeed you may want to use something as a TabControl + RadBook.

Another option is to flatten your hierarchy before binding it to the RadBook and use the categories / chapters in a control (like a TreeView) that will act as "contents".

In these examples the book control is databound:

http://demos.telerik.com/silverlight/#Book/Performance

http://demos.telerik.com/silverlight/#Book/Binding

All the best,
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
0
prog1
Top achievements
Rank 1
answered on 10 Aug 2010, 02:06 PM
Isn't there a way, that one item is represented by 2 Pages?
Do this by code and set every PageItem his own Datacontext?
0
Miroslav
Telerik team
answered on 10 Aug 2010, 02:20 PM
Hi prog1,

There is no easy way to represent one item by two pages, the RadBook is an ItemsControl and for each data item is created one control (RadBookItem) to represent it.

I can suggest creating a ViewModel for the data that you want to represent where each original item that needs two pages is represented by two items.

Best wishes,
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
0
prog1
Top achievements
Rank 1
answered on 10 Aug 2010, 02:43 PM

foreach
(Question item in this.context.Questions)
               {
                   RadBookItem leftItem = new RadBookItem();
                   leftItem.DataContext = item;
                   book.Items.Add(leftItem);
                   RadBookItem rightItem = new RadBookItem();
                   rightItem.DataContext = item;
                   book.Items.Add(rightItem);
               }

That what I'm doing now and it seems to work. VieModel would be an alternative.
Thank you.
Tags
Book
Asked by
prog1
Top achievements
Rank 1
Answers by
Miroslav
Telerik team
prog1
Top achievements
Rank 1
Share this question
or