Hi Quan,
1. You can just cast the RadPageViewItem to RadPageViewExplorerBarItem. When you are in explorer bar view, this cast will pass and you will have access to the IsExpanded property:
2. In regards to the animation, RadPageView does not feature expand animation, however, you could use a timer and the PageLength property to achieve such. Here is an example:
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
AddPageView();
radPageView1.ViewMode = PageViewMode.ExplorerBar;
RadPageViewExplorerBarElement explorerBarElement = radPageView1.ViewElement
as
RadPageViewExplorerBarElement;
foreach
(RadPageViewExplorerBarItem item
in
explorerBarElement.Items)
{
item.MouseHover += item_MouseHover;
item.AssociatedContentAreaElement.RadPropertyChanging += AssociatedContentAreaElement_RadPropertyChanging;
}
timer =
new
System.Windows.Forms.Timer();
timer.Interval =30;
timer.Tick += timer_Tick;
radPageView1.PageExpanded += radPageView1_PageExpanded;
}
void
timer_Tick(
object
sender, EventArgs e)
{
currentPage.PageLength += 20;
if
(currentPage.PageLength >= 300)
{
timer.Stop();
}
}
System.Windows.Forms.Timer timer;
RadPageViewPage currentPage;
void
radPageView1_PageExpanded(
object
sender, RadPageViewEventArgs e)
{
timer.Stop();
currentPage = e.Page;
currentPage.PageLength = 0;
timer.Start();
}
void
AssociatedContentAreaElement_RadPropertyChanging(
object
sender, RadPropertyChangingEventArgs args)
{
if
(args.Property.Name ==
"Bounds"
)
{
//suspend layout when animating
args.Cancel = timer.Enabled;
}
}
void
item_MouseHover(
object
sender, EventArgs e)
{
RadPageViewExplorerBarItem item = (RadPageViewExplorerBarItem)sender;
RadPageViewExplorerBarElement explorerBarElement = radPageView1.ViewElement
as
RadPageViewExplorerBarElement;
foreach
(RadPageViewExplorerBarItem i
in
explorerBarElement.Items)
{
i.IsExpanded =
false
;
}
item.IsExpanded =
true
;
}
I hope that you find this information useful.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.