New to Telerik UI for WinForms? Start a free 30-day trial
Programmatically adding pages
Updated over 6 months ago
This help article will demonstrate how RadPageViewPages can be added to RadPageView programmatically.
Programmatically adding RadPageViewPages to RadPageView
Simply all that has to be done is to create an instance of RadPageViewPage, set the desired properties (i.e Text, Font etc), and add the instance to the Pages collection of RadPageView. The following code snippet demonstrated this behavior:
Adding pages
C#
RadPageViewPage pageOne = new RadPageViewPage();
pageOne.Text = "First Page";
radPageView1.Pages.Add(pageOne);
RadPageViewPage pageTwo = new RadPageViewPage();
pageTwo.Text = "Second Page";
radPageView1.Pages.Add(pageTwo);
In case you need to add a page at a certain position, feel free to use the Pages.Insert method passing the desired position index and the RadPageViewPage instance you want to add.
Adding Controls to RadPageViewPage
Additionally, adding other controls to a specified RadPageViewPage programmatically, can be achieved by simply adding the desired control to the Controls collection of the desired page, as shown in the next example:
Adding controls to a page
C#
RadButton button = new RadButton();
button.Text = "My Button";
pageOne.Controls.Add(button);