Hello Khizar,
I apologize for the late reply. I was trying to find an acceptable solution for your question, because this seems to be a missing feature and I added it in our issue tracking system as a feature request. We will consider implementing it in a future version.
My efforts, in fact, leaded to a solution, that I think covers your requirements. You can implement the desired behavior by overriding
RadPageView class and doing some reflection. Please consider the following example:
public class CustomPageView : RadPageView
{
public override string ThemeClassName
{
get { return typeof(RadPageView).FullName; }
set {}
}
protected override RadPageViewElement CreateUI()
{
return new CustomExplorerBarElement();
}
}
public class CustomExplorerBarElement : RadPageViewExplorerBarElement
{
protected override Type ThemeEffectiveType
{
get
{
return typeof(RadPageViewExplorerBarElement);
}
}
FieldInfo fi;
MethodInfo mi;
public CustomExplorerBarElement()
{
fi = typeof(RadPageViewExplorerBarElement).GetField("initialLayoutOffset", BindingFlags.Instance | BindingFlags.NonPublic);
mi = typeof(RadPageViewExplorerBarElement).GetMethod("CorrectLayoutOffset", BindingFlags.Instance | BindingFlags.NonPublic);
}
public void ScrollTo(RadPageViewExplorerBarItem item)
{
RectangleF clientRect = this.GetClientRectangle(this.Size);
Padding ncMargin = this.GetNCMetrics();
clientRect.Y += ncMargin.Top;
clientRect.X += ncMargin.Left;
clientRect.Width -= ncMargin.Horizontal;
clientRect.Height -= ncMargin.Vertical;
RectangleF itemRectangle = item.BoundingRectangle;
itemRectangle.Height += item.Page.Height;
RectangleF intersectionRect = RectangleF.Intersect(clientRect, itemRectangle);
fi.SetValue(this, (int)fi.GetValue(this) + (int)(clientRect.Top - itemRectangle.Top));
int initialLayoutOffset = (int)mi.Invoke(this,new object[] {});
fi.SetValue(this, initialLayoutOffset);
this.Scrollbar.Value = -initialLayoutOffset;
this.InvalidateMeasure();
this.UpdateLayout();
}
protected override void OnExpandedChanged(RadPageViewExpandedChangedEventArgs e)
{
base.OnExpandedChanged(e);
if (e.Expanded)
{
UpdateLayout();
Application.DoEvents();
ScrollTo((RadPageViewExplorerBarItem)e.Item);
InvalidateMeasure(true);
UpdateLayout();
Application.DoEvents();
}
}
}
I hope this solution fits in your case. If you have further questions, do not hesitate to ask.
All the best,
Jack
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!