Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Hiding tab when only 1 page is displayed

Not answered Hiding tab when only 1 page is displayed

Feed from this thread
  • Rodney avatar

    Posted on Sep 26, 2011 (permalink)

    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.


    Reply

  • Ivan Petrov Ivan Petrov admin's avatar

    Posted on Sep 29, 2011 (permalink)

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

    Reply

  • Say Hello to Telerik's PivotGrid for ASP.NET AJAX, Silverlight, WPF and WinForms. Now packed with OLAP support.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > PageView > Hiding tab when only 1 page is displayed