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