I was just looking at the Demo (on the website) and looking at the code on binding and Templates for left page and right page.
Here some questions/suggestions:
a) Can we have a separate template for "Front and back" cover page? With the current implementation, of having Left and right template, how can we have a Front and back cover that does not look like the pages inside?
b) Let's say We create Left and right page templates and we connect the ItemsSource of the book to some data about watches. These templates will have the layout to show info about watches. After the book prints the pages for watches, I would like to activate another set of Templates to display Sunglasses in the same. How can we have more than one set of templates in one book?
Ideally, I would like to print a catalog of items grouped by their templates. This is important to have.
Thanks!
..Ben
Here some questions/suggestions:
a) Can we have a separate template for "Front and back" cover page? With the current implementation, of having Left and right template, how can we have a Front and back cover that does not look like the pages inside?
b) Let's say We create Left and right page templates and we connect the ItemsSource of the book to some data about watches. These templates will have the layout to show info about watches. After the book prints the pages for watches, I would like to activate another set of Templates to display Sunglasses in the same. How can we have more than one set of templates in one book?
Ideally, I would like to print a catalog of items grouped by their templates. This is important to have.
Thanks!
..Ben
9 Answers, 1 is accepted
0
Accepted
Hi Ben,
1) We will definitely have separate templates for front and back cover, once we implement the front and back cover functionality. Also, the front and back cover will flip differently than the inner pages. I have created a small demo that shows how to apply different templates based on the index of the page. Soon I am going to write a help article that explains in details how this demo works, but for the moment you can have a look at the example and if you have questions regarding it, you can contact me.
2) I am not sure whether I fully understand the functionality you are trying to describe. Is it that you want, for example, page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template"?
Greetings,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
1) We will definitely have separate templates for front and back cover, once we implement the front and back cover functionality. Also, the front and back cover will flip differently than the inner pages. I have created a small demo that shows how to apply different templates based on the index of the page. Soon I am going to write a help article that explains in details how this demo works, but for the moment you can have a look at the example and if you have questions regarding it, you can contact me.
2) I am not sure whether I fully understand the functionality you are trying to describe. Is it that you want, for example, page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template"?
Greetings,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ben Hayat
Top achievements
Rank 2
answered on 05 Nov 2009, 05:12 PM
Hi Kiril;
1) We will definitely have separate templates for front and back cover, once we implement the front and back cover functionality. Also, the front and back cover will flip differently than the inner pages. I have created a small demo that shows how to apply different templates based on the index of the page. Soon I am going to write a help article that explains in details how this demo works, but for the moment you can have a look at the example and if you have questions regarding it, you can contact me.
Excellent and I'll let you know once I'm in it.
Is it that you want, for example, page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template"?
Exactly... My vision is that, not all pages should or would be the same layout. For example pages related to watches, have different info to show v.s. pages related to sunglasses. However, they all need to be in one book for "Holiday Special" items, that a company wants to promote.
But looking at the bigger picture, it would be great to have the freedom and flexibility of using multiple sets (left page, right page) templates within a book. i.e. page 1 and 2 (company info) page 3 - 8 products (different templates for products), Page 9-14, company services and etc. Now the book cab be used a full site entity.
Hope this helps!
Thank you Kiril!
..Ben
1) We will definitely have separate templates for front and back cover, once we implement the front and back cover functionality. Also, the front and back cover will flip differently than the inner pages. I have created a small demo that shows how to apply different templates based on the index of the page. Soon I am going to write a help article that explains in details how this demo works, but for the moment you can have a look at the example and if you have questions regarding it, you can contact me.
Excellent and I'll let you know once I'm in it.
Is it that you want, for example, page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template"?
Exactly... My vision is that, not all pages should or would be the same layout. For example pages related to watches, have different info to show v.s. pages related to sunglasses. However, they all need to be in one book for "Holiday Special" items, that a company wants to promote.
But looking at the bigger picture, it would be great to have the freedom and flexibility of using multiple sets (left page, right page) templates within a book. i.e. page 1 and 2 (company info) page 3 - 8 products (different templates for products), Page 9-14, company services and etc. Now the book cab be used a full site entity.
Hope this helps!
Thank you Kiril!
..Ben
0
Ben Hayat
Top achievements
Rank 2
answered on 05 Nov 2009, 06:45 PM
Some new thoughts...
After giving it more thought to the second issue regarding multi templates, here is my suggestion.
If you create another container layer in the book, let's called it "section" for now, then we can have multiple sections (Like the Docking control that has multiple panes) and then each section can have it Left/right page templates or no templates. This way we can create a series of sequential sections in one book. These sections could also be considered as "Chapters". I think this will provide a flexible solution!
..Ben
After giving it more thought to the second issue regarding multi templates, here is my suggestion.
If you create another container layer in the book, let's called it "section" for now, then we can have multiple sections (Like the Docking control that has multiple panes) and then each section can have it Left/right page templates or no templates. This way we can create a series of sequential sections in one book. These sections could also be considered as "Chapters". I think this will provide a flexible solution!
..Ben
0
Hello Ben,
This functionality: "page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template" can easily be achieved by having just one DataTemplateSelector and pass it to both LeftPageTemplateSelector and RightPageTemplateSelector. Then in the SelectTemplate override of this DataTemplateSelector, you can pick the proper DataTemplate based on the page's Index property.
For further reference, you can take a look at the attached sample project.
Greetings,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
This functionality: "page 1, 2, 3, and 4 to have a "watch template" and page 5, 6, 7, 8 etc. to have "sunglasses template" can easily be achieved by having just one DataTemplateSelector and pass it to both LeftPageTemplateSelector and RightPageTemplateSelector. Then in the SelectTemplate override of this DataTemplateSelector, you can pick the proper DataTemplate based on the page's Index property.
public
class
PageTemplateSelector : DataTemplateSelector
{
public
DataTemplate SunglassTemplate {
get
;
set
; }
public
DataTemplate WatchTemplate {
get
;
set
; }
public
DataTemplate BathingSuitTemplate {
get
;
set
; }
public
override
DataTemplate SelectTemplate(
object
item, DependencyObject container)
{
RadBookItem page = container
as
RadBookItem;
if
(page.Index <= 2)
{
return
this
.SunglassTemplate;
}
else
if
(page.Index >= 3 && page.Index <= 5)
{
return
this
.WatchTemplate;
}
else
{
return
this
.BathingSuitTemplate;
}
}
}
<!-- Notice the same DataTemplateSelector being passed to both LeftPageTemplateSelector and RightPageTemplateSelector -->
<
telerikNavigation:RadBook
x:Name
=
"book1"
LeftPageTemplateSelector
=
"{StaticResource PageTemplateSelector}"
RightPageTemplateSelector
=
"{StaticResource PageTemplateSelector}"
/>
For further reference, you can take a look at the attached sample project.
Greetings,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ben Hayat
Top achievements
Rank 2
answered on 06 Nov 2009, 03:46 PM
Hi Kiril;
Very interesting and thanks. I'm hoping you will give us some docs soon :-)
you can pick the proper DataTemplate based on the page's Index property.
Looking at the code which means I need to make "Data Template switch" based on Page.Index, raises a question. Let's say the end user is doing a filter and asking program, "Show me toay's sale between $10 and $50". This filter may generate 25 Sunglasses and 2 watches. But if the filter is changed to "$10 - $100", it may return 40 sunglasses and 15 watches. This, at runtime will affect the Page.Index where the sunglasses will begin rather than the first filter. In fact at runtime, I would not know what Page.index will the sunglasses begin, because the number of returned watches have changed to push it further back. Unless, I have some way of calculating how many watches will fall into each page. But I have no idea, what the enduser will use as products, Bycicles , watches, rings and etc.
My question is now, does it mean, that we have to know at design time at what Page.Index each category begins?
Thank you Kiril;
..Ben
Very interesting and thanks. I'm hoping you will give us some docs soon :-)
you can pick the proper DataTemplate based on the page's Index property.
Looking at the code which means I need to make "Data Template switch" based on Page.Index, raises a question. Let's say the end user is doing a filter and asking program, "Show me toay's sale between $10 and $50". This filter may generate 25 Sunglasses and 2 watches. But if the filter is changed to "$10 - $100", it may return 40 sunglasses and 15 watches. This, at runtime will affect the Page.Index where the sunglasses will begin rather than the first filter. In fact at runtime, I would not know what Page.index will the sunglasses begin, because the number of returned watches have changed to push it further back. Unless, I have some way of calculating how many watches will fall into each page. But I have no idea, what the enduser will use as products, Bycicles , watches, rings and etc.
My question is now, does it mean, that we have to know at design time at what Page.Index each category begins?
Thank you Kiril;
..Ben
0
Hello Ben,
I have prepared a small project that demonstrates how to filter a collection of items and pass the filtered collection as an ItemsSource to RadBook.
The project consists of three DataTemplates - RingTemplate, BicycleTemplate and WatchTemplate. There is also 1 DataTemplateSelector, that determines which DataTemplate to pick based on the type of the business object.
My business model consists of 5 types(classes): a base class StoreItem that has Price and Name:
Then 3 classes: Watch, Ring and Bicycle that inherit StoreItem:
Finally, I have an ObservableCollection consisting of various items:
I have also added a RadSlider that is range enable. On SelectionRangeChanged of RadSlider, I filter the collection and pass it back to RadBook:
While preparing this sample I noticed that RadBook experiences some problem with constant reassigning of the ItemsSource. This problem will be fixed as soon as possible. Meanwhile, have a look at the sample and let me know if you find something else.
Best wishes,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I have prepared a small project that demonstrates how to filter a collection of items and pass the filtered collection as an ItemsSource to RadBook.
The project consists of three DataTemplates - RingTemplate, BicycleTemplate and WatchTemplate. There is also 1 DataTemplateSelector, that determines which DataTemplate to pick based on the type of the business object.
public
class
PageTemplateSelector : DataTemplateSelector
{
public
DataTemplate RingTemplate {
get
;
set
; }
public
DataTemplate BicycleTemplate {
get
;
set
; }
public
DataTemplate WatchTemplate {
get
;
set
; }
public
override
DataTemplate SelectTemplate(
object
item, DependencyObject container)
{
if
(item
is
Ring)
{
return
RingTemplate;
}
else
if
(item
is
Bicycle)
{
return
BicycleTemplate;
}
else
//item is Watch
{
return
WatchTemplate;
}
}
}
My business model consists of 5 types(classes): a base class StoreItem that has Price and Name:
public
class
StoreItem
{
public
StoreItem()
{
this
.Price = 0;
this
.Name =
string
.Empty;
}
public
int
Price {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
Then 3 classes: Watch, Ring and Bicycle that inherit StoreItem:
public
class
Ring : StoreItem
{
public
Ring(
int
price)
{
this
.Price = price;
}
}
public
class
Watch : StoreItem
{
public
Watch(
int
price)
{
this
.Price = price;
}
}
public
class
Bicycle : StoreItem
{
public
Bicycle(
int
price)
{
this
.Price = price;
}
}
Finally, I have an ObservableCollection consisting of various items:
public
class
StoreItems : ObservableCollection<StoreItem>
{
public
StoreItems()
{
// Generate random number of items with random prices
}
}
I have also added a RadSlider that is range enable. On SelectionRangeChanged of RadSlider, I filter the collection and pass it back to RadBook:
private
void
FilterCollection()
{
// select all items that fall between SelectionStart and SelectionEnd of RadSlider
var newsource = storeItems.Where(item => item.Price >= priceSlider.SelectionStart && item.Price <= priceSlider.SelectionEnd).ToList();
book1.ItemsSource = newsource;
}
While preparing this sample I noticed that RadBook experiences some problem with constant reassigning of the ItemsSource. This problem will be fixed as soon as possible. Meanwhile, have a look at the sample and let me know if you find something else.
Best wishes,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Stephane
Top achievements
Rank 1
answered on 09 Dec 2009, 10:55 PM
Hey Guys,
Is there a way to bind data only on some of the pages? The problem is when I assign a datasource and I use the different templates, there is no way for me not to display the data and have the binding carry to the next page.
Even I could skip the first and last page that would be great.
Thanks,
Stephane
Is there a way to bind data only on some of the pages? The problem is when I assign a datasource and I use the different templates, there is no way for me not to display the data and have the binding carry to the next page.
Even I could skip the first and last page that would be great.
Thanks,
Stephane
0
Hello Stephane,
Regards,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
This functionality is not supported out of the box. For this particular scenario, you will have to modify your data source in such a way that there are "dummy" items between each data item. Then using a template selector you can decide which template to use based on the type of the item. I have attached a sample project demonstrating this functionality. I don't know whether this is acceptable for your scenario, but give it a try and let me know how it works for you.
Regards,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Stephane
Top achievements
Rank 1
answered on 14 Dec 2009, 02:18 PM
Thanks Kiril. I was thinking along the same lines. They way you implemented it is actually a lot more elegant. I was able to create the results I needed.
Thanks for the help!
Stephane
Thanks for the help!
Stephane