PageView Tab Show Hide Problem

5 posts, 1 answers
  1. meraj
    meraj avatar
    47 posts
    Member since:
    Dec 2010

    Posted 20 Jan 2011 Link to this post

    Hi,
    I am using PageView Control of view mode strip like Tab i want to hide some tabs which is PageviewPage in PageView ,
    on check box click event,and also want to hide some tabs first time when page is load.Is there any way to do this.
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Jan 2011 Link to this post

    Hello,

    Yes, you can do this via
    Me.PageViewPage1.Item.Visibility = ElementVisibility.Collapsed


    Here is a full example that you can copy into a new project

    Designer File (VB)
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Class Form1
        Inherits System.Windows.Forms.Form
      
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
      
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
      
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.RadPageView1 = New Telerik.WinControls.UI.RadPageView()
            Me.CheckBox1 = New System.Windows.Forms.CheckBox()
            CType(Me.RadPageView1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'RadPageView1
            '
            Me.RadPageView1.Location = New System.Drawing.Point(0, 0)
            Me.RadPageView1.Name = "RadPageView1"
            Me.RadPageView1.Size = New System.Drawing.Size(574, 436)
            Me.RadPageView1.TabIndex = 0
            Me.RadPageView1.Text = "RadPageView1"
            '
            'CheckBox1
            '
            Me.CheckBox1.AutoSize = True
            Me.CheckBox1.Location = New System.Drawing.Point(418, 452)
            Me.CheckBox1.Name = "CheckBox1"
            Me.CheckBox1.Size = New System.Drawing.Size(123, 17)
            Me.CheckBox1.TabIndex = 1
            Me.CheckBox1.Text = "Show / Hide Page 1"
            Me.CheckBox1.UseVisualStyleBackColor = True
            '
            'Form1
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(574, 494)
            Me.Controls.Add(Me.CheckBox1)
            Me.Controls.Add(Me.RadPageView1)
            Me.Name = "Form1"
            Me.Text = "Form1"
            CType(Me.RadPageView1, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)
            Me.PerformLayout()
      
        End Sub
        Friend WithEvents RadPageView1 As Telerik.WinControls.UI.RadPageView
        Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
      
    End Class


    Form1.vb
    Imports Telerik.WinControls
    Imports Telerik.WinControls.Localization
    Imports Telerik.WinControls.UI
    Imports Telerik.WinControls.UI.Localization
      
      
    Public Class Form1
      
        Private m_Page1 As New RadPageViewPage()
        Private m_Page2 As New RadPageViewPage()
        Private m_Page3 As New RadPageViewPage()
      
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
            '// Add the pages to the Page View
            Me.RadPageView1.ViewMode = PageViewMode.Strip
            m_Page1.Text = "Page 1"
            Me.RadPageView1.Pages.Add(m_Page1)
            m_Page2.Text = "Page 2"
            Me.RadPageView1.Pages.Add(m_Page2)
            m_Page3.Text = "Page 3"
            Me.RadPageView1.Pages.Add(m_Page3)
      
            '// Select a Page
            Me.RadPageView1.SelectedPage = m_Page3
      
            '// Set Page 3 to invisible
            Me.m_Page1.Item.Visibility = ElementVisibility.Collapsed
      
        End Sub
      
        Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
            If Me.CheckBox1.Checked Then
                Me.m_Page1.Item.Visibility = ElementVisibility.Visible
            Else
                Me.m_Page1.Item.Visibility = ElementVisibility.Collapsed
            End If
        End Sub
    End Class

    let me know if you have further questions
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 23 Jan 2011 Link to this post

    Hello,

    did this help? If so please remember to mark as answer. If you need further help please let me know
    Richard
  5. meraj
    meraj avatar
    47 posts
    Member since:
    Dec 2010

    Posted 25 Jan 2011 Link to this post

    Thanx for this help its very helpful
  6. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 25 Jan 2011 Link to this post

    You're welcome. I'm glad that helped
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready