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

RadPageView Tabs and Pages

5 Answers 1611 Views
PageView
This is a migrated thread and some comments may be shown as answers.
Janusz Oldakowski
Top achievements
Rank 1
Janusz Oldakowski asked on 06 Feb 2012, 09:51 PM
1) Is it possible to create tabs like they are shown in the picture with the RadPageView?

2) How would one create a single tab visually, and then make an exact copy programatically when new user's data needs to be displayed on new tab?

Thanks for any help with this.

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2012, 11:57 AM
Hello,

You can customise the look and feel of the tabs, either through themes, or by altering the properties of the 'Item' which is a property from each RadPageViewPage. E.g.

this.radPageViewPage1.Item.NumberOfColors = 1;
this.radPageViewPage1.Item.BackColor = System.Drawing.Color.Gray;

this help topic will tell you how to create a RadPageViewPage at design time, and this help topic will explain how to create new pages programatically.

Hope this helps.
Richard

0
Janusz Oldakowski
Top achievements
Rank 1
answered on 09 Feb 2012, 02:06 PM
Thanks for such a quick replay, and I am sorry for not being clear on the questions.

For question two, what I have ment to ask is:

If I crate a label called lblLastName, a field called txtLastName, and a button btnOk in the designer for Tab One. Have these fields bind to a properties of a class called person. The tab header would say Person One.
Is there are way to copy tab one programattically to be a tab two, that would have the same controls with the same names, and same bindings, so that when another person object is is added, it will bind appropriately. I guess what I have seen is that the scope of controls placed on the tabs within the RadPageView is global, not local to the individual RadPageViewPage as one would have expected.
0
Richard Slade
Top achievements
Rank 2
answered on 09 Feb 2012, 03:01 PM
Hello,

You can set the items to the desired behaviour, either using the smart tag and selecting the Item Fit Mode to Fill, or in code as follows:

((RadPageViewStripElement)this.radPageView1.RootElement.Children[0]).ItemFitMode = StripViewItemFitMode.Fill;

Here is a full example which creates new pages (which are the same) for each button click.

Form Designer
namespace RadControlsWinFormsApp1
{
    partial class RadForm1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.radPageView1 = new Telerik.WinControls.UI.RadPageView();
            this.radButton1 = new Telerik.WinControls.UI.RadButton();
            ((System.ComponentModel.ISupportInitialize)(this.radPageView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.radButton1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            this.SuspendLayout();
            //
            // radPageView1
            //
            this.radPageView1.Location = new System.Drawing.Point(12, 12);
            this.radPageView1.Name = "radPageView1";
            this.radPageView1.Size = new System.Drawing.Size(451, 233);
            this.radPageView1.TabIndex = 0;
            this.radPageView1.Text = "radPageView1";
            ((Telerik.WinControls.UI.RadPageViewStripElement)(this.radPageView1.GetChildAt(0))).StripButtons = Telerik.WinControls.UI.StripViewButtons.None;
            ((Telerik.WinControls.UI.RadPageViewStripElement)(this.radPageView1.GetChildAt(0))).ItemFitMode = Telerik.WinControls.UI.StripViewItemFitMode.Fill;
            //
            // radButton1
            //
            this.radButton1.Location = new System.Drawing.Point(322, 251);
            this.radButton1.Name = "radButton1";
            this.radButton1.Size = new System.Drawing.Size(130, 24);
            this.radButton1.TabIndex = 1;
            this.radButton1.Text = "Copy Page";
            this.radButton1.Click += new System.EventHandler(this.radButton1_Click);
            //
            // RadForm1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(475, 280);
            this.Controls.Add(this.radButton1);
            this.Controls.Add(this.radPageView1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "RadForm1";
            //
            //
            //
            this.RootElement.ApplyShapeToControl = true;
            this.Text = "RadForm1";
            this.ThemeName = "ControlDefault";
            this.Load += new System.EventHandler(this.RadForm1_Load);
            ((System.ComponentModel.ISupportInitialize)(this.radPageView1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.radButton1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadPageView radPageView1;
        private Telerik.WinControls.UI.RadButton radButton1;
 
 
 
 
 
 
    }
}

Form1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using Telerik.WinControls.Layouts;
 
namespace RadControlsWinFormsApp1
{
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        private List<User> m_Users = new List<User>();
 
        public RadForm1()
        {
            InitializeComponent();
        }
 
        private void RadForm1_Load(object sender, EventArgs e)
        {
            ((RadPageViewStripElement)this.radPageView1.RootElement.Children[0]).ItemFitMode = StripViewItemFitMode.Fill;
 
            m_Users.Add(new User(1, "Richard"));
            m_Users.Add(new User(2, "Pete"));
            m_Users.Add(new User(3, "Chris"));
        }
 
 
        private void radButton1_Click(object sender, EventArgs e)
        {
            RadGridView grid = new RadGridView();
            RadPageViewPage page = new RadPageViewPage();
            page.Text = "Page " + (this.radPageView1.Pages.Count + 1).ToString();
            this.radPageView1.Pages.Add(page);
            page.Controls.Add(grid);
            grid.Dock = DockStyle.Fill;
            grid.DataSource = m_Users;
            this.radPageView1.SelectedPage = page;
        }    
    }
 
 
    public class User
    {
        public User(int id, string name)
        {
            Id = id;
            Name = name;
        }
 
        public User()
        { }
 
        public int Id
        {
            get;
            set;
        }
 
        public string Name
        {
            get;
            set;
        }
    }
 
}

Hope that helps
Richard




0
Shailesh
Top achievements
Rank 1
answered on 12 Jul 2012, 05:35 AM
Hello Team,
I using RadPageView in my C# .net Window form.
Is it possible to create tabs like they are shown in the picture with the RadPageView? If yes, then please tell me, how can I achive this? Which properties need to set at design time?

Thanks and Regards,
Shailesh
0
Boryana
Telerik team
answered on 16 Jul 2012, 01:52 PM
Hi Shailesh,

Thank you for writing.

The following snippet illustrates which properties you need to set in order to achieve the look and feel of the both Records and Activities tabs. Please bear in mind that setting these properties at run-time will overwrite the colors set by the theme, thus cancelling any hover/selection effects. If you would like to keep these, you will need to customize the theme you are using through setting the properties below to the appropriate states (MouseOver, Selected, etc.):
this.radPageView1.ViewElement.BackColor = Color.FromArgb(59, 61, 60);
this.radPageView1.ViewElement.ItemSpacing = 2;
this.radPageView1.ViewElement.ContentArea.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
this.radPageView1.ViewElement.ContentArea.BorderColor = Color.FromArgb(59, 61, 60);
 
this.radPageViewPage1.Item.ForeColor = Color.FromArgb(180, 180, 180);
this.radPageViewPage1.Item.DrawFill = false;
this.radPageViewPage1.Item.DrawBorder = false;
this.radPageViewPage1.Item.Padding = new Padding(5, 10, 5, 10);
 
this.radPageViewPage2.Item.DrawFill = true;
this.radPageViewPage2.Item.DrawBorder = true;
this.radPageViewPage2.Item.BackColor = Color.FromArgb(80, 80, 80);
this.radPageViewPage2.Item.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
this.radPageViewPage2.Item.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
this.radPageViewPage2.Item.BorderColor = Color.FromArgb(80, 80, 80);
this.radPageViewPage2.Item.BorderGradientStyle = Telerik.WinControls.GradientStyles.Solid;
this.radPageViewPage2.Item.ForeColor = Color.FromArgb(180, 180, 180);
this.radPageViewPage2.Item.Padding = new Padding(5, 10, 5, 10);

Here are some useful articles in case you would like to use a custom theme:

I hope my answer helps.

Greetings,
Boryana
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
PageView
Asked by
Janusz Oldakowski
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Janusz Oldakowski
Top achievements
Rank 1
Shailesh
Top achievements
Rank 1
Boryana
Telerik team
Share this question
or