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

Hiding tab when only 1 page is displayed

1 Answer 110 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Rodney
Top achievements
Rank 1
Rodney asked on 26 Sep 2011, 06:23 PM
I have pageview control when can display 1 or many tabs.  In the case where there is only 1 page of data to display I would like to hide the tab caption.


1 Answer, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 29 Sep 2011, 09:02 AM
Hello Rodney,

Thank you for writing.

You can achieve this by subscribing to the RadPageView PageAdded and PageRemoved events and change the visibility of the tabs item container. Here is a code snippet that demonstrates this:

private void radPageView1_PageAdded(object sender, RadPageViewEventArgs e)
{
  this.SetItemContainerVisibility();
}
 
private void radPageView1_PageRemoved(object sender, RadPageViewEventArgs e)
{
  this.SetItemContainerVisibility();
}
 
private void SetItemContainerVisibility()
{
  if (this.radPageView1.Pages.Count == 1)
  {
    (this.radPageView1.ViewElement as RadPageViewStripElement).ItemContainer.Visibility = ElementVisibility.Collapsed;
  }
  else
  {
    (this.radPageView1.ViewElement as RadPageViewStripElement).ItemContainer.Visibility = ElementVisibility.Visible;
  }
}

I hope this will be useful for you. If you have further questions, I would be glad to help. Best wishes,
Ivan Petrov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
PageView
Asked by
Rodney
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Share this question
or