Hiding tab when only 1 page is displayed

2 posts, 0 answers
  1. Rodney
    Rodney avatar
    4 posts
    Member since:
    Sep 2011

    Posted 26 Sep 2011 Link to this post

    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.


  2. Ivan Petrov
    Admin
    Ivan Petrov avatar
    695 posts
    Member since:
    Dec 2014

    Posted 29 Sep 2011 Link to this post

    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 >>

Back to Top