Hi,
Is there a way to navigate a book to a specific page from code behind? I want to create a table of content besides the book that the user could also use for navigation just like the attached image
Thanks,
Paul
Is there a way to navigate a book to a specific page from code behind? I want to create a table of content besides the book that the user could also use for navigation just like the attached image
Thanks,
Paul
4 Answers, 1 is accepted
0
Hello Paul,
A possible approach could be seen in this demo. You can examine its code. The table of contents is realized with RadTreeView and basically it uses the Tag property for navigation. Feel free to ask if you need more info on this.
Greetings,
Petar Mladenov
the Telerik team
A possible approach could be seen in this demo. You can examine its code. The table of contents is realized with RadTreeView and basically it uses the Tag property for navigation. Feel free to ask if you need more info on this.
Greetings,
Petar Mladenov
the Telerik team
0
Paul
Top achievements
Rank 1
answered on 18 Feb 2011, 02:01 PM
Hi Petar,
That seems like a good approach. Can you elaborate on the use of the TAG property. I do no see any method in the RadBook that permits navigation using the Tag property (i.e.: something like myBook.GoToTag("mytag")).
Paul
That seems like a good approach. Can you elaborate on the use of the TAG property. I do no see any method in the RadBook that permits navigation using the Tag property (i.e.: something like myBook.GoToTag("mytag")).
Paul
0
Accepted
Hi Paul,
You can examine the source code of the example by clicking the "ViewCode" button.
In the XAML part of the application you can see that different RadTreeViewItems that specify the contents of the book, have their Tag property set:
Then, in code behind , we parse the Tag into int (pageindex) and navigate to the Page corresponding to the parsed pageindex:
Hope this has helped you.
Greetings,
Petar Mladenov
the Telerik team
You can examine the source code of the example by clicking the "ViewCode" button.
In the XAML part of the application you can see that different RadTreeViewItems that specify the contents of the book, have their Tag property set:
<
telerik:RadTreeView
Margin
=
"25,45,25,0"
x:Name
=
"RadTreeView1"
>
<
telerik:RadTreeViewItem
Tag
=
"4"
Header
=
"UI Components"
IsExpanded
=
"True"
>
<
telerik:RadTreeViewItem
Cursor
=
"Hand"
DefaultImageSrc
=
"../Images/Book/Icons/aspnet.png"
Header
=
"ASP.NET Ajax"
/>
<
telerik:RadTreeViewItem
Cursor
=
"Hand"
DefaultImageSrc
=
"../Images/Book/Icons/Sl.png"
Header
=
"Silverlight"
/>
<
telerik:RadTreeViewItem
Cursor
=
"Hand"
DefaultImageSrc
=
"../Images/Book/Icons/mvc.png"
Header
=
"ASP.NET MVC"
/>
<
telerik:RadTreeViewItem
Cursor
=
"Hand"
DefaultImageSrc
=
"../Images/Book/Icons/winforms.png"
Header
=
"Winforms"
/>
<
telerik:RadTreeViewItem
Cursor
=
"Hand"
DefaultImageSrc
=
"../Images/Book/Icons/wpf.png"
Header
=
"WPF"
/>
</
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Data"
Tag
=
"6"
IsExpanded
=
"True"
>
<telerik:RadTreeViewItem Cursor="Hand"
void
RadTreeViewItem_MouseLeftButtonDown(
object
sender, System.Windows.Input.MouseButtonEventArgs e)
{
if
(
this
.foldActivated)
{
return
;
}
RadTreeViewItem item = (e.OriginalSource
as
FrameworkElement).ParentOfType<RadTreeViewItem>();
if
(item ==
null
)
return
;
object
tag = (item.Parent
as
FrameworkElement).Tag;
if
(tag ==
null
)
return
;
int
pageIndex = Int16.Parse(tag.ToString());
if
(pageIndex > 0)
{
RadBook1.RightPageIndex = pageIndex;
}
}
Greetings,
Petar Mladenov
the Telerik team
0
Paul
Top achievements
Rank 1
answered on 18 Feb 2011, 03:41 PM
Hi Petar,
Yes, that helps.
Thanks,
Paul
Yes, that helps.
Thanks,
Paul