New to Telerik UI for WinForms? Download free 30-day trial

New Item

RadPageView supports a special kind of page item that prompts the end-user to create a new page at run time by clicking that item. Let's call the item NewItem. When the NewItem is clicked, a special event is fired where the developer can decide what exactly should be done - in the context of RadPageView usually a new RadPageViewPage is being created.

WinForms RadPageView New Item Button

Enabling the NewItem

You can easily show the NewItem by setting the NewItemVisibility property of the RadPageViewStripElement. This property is of the enum type StripViewNewItemVisibility and has the following possible values:

  • Hidden (default value): The NewItem is hidden.

  • Front: The NewItem appears in front of the other page items in the items strip area.

WinForms RadPageView New Item Front

  • End: The NewItem appears at the end of the row of page items in the items strip area.

WinForms RadPageView New Item End

Here is how to set the NewItemVisibility property:

RadPageViewStripElement stripElement = this.radPageView1.ViewElement as RadPageViewStripElement;
stripElement.NewItemVisibility = StripViewNewItemVisibility.End;

Dim stripElement As RadPageViewStripElement = TryCast(Me.RadPageView1.ViewElement, RadPageViewStripElement)
stripElement.NewItemVisibility = StripViewNewItemVisibility.End

Handling the Clicked NewItem

When the NewItem is clicked by the end-user, RadPageView throws an event called NewPageRequested. There you can create a new RadPageViewPage instance and add it to RadPageView. In the following code snippet we create a new RadPageViewPage, add it to RadPageView, select the newly created page, and make sure that the page item is fully visible by calling the EnsureItemVisible method.

void radPageView1_NewPageRequested(object sender, EventArgs e)
    RadPageView pageView = sender as RadPageView;
    RadPageViewStripElement stripElement = pageView.ViewElement as RadPageViewStripElement;
    RadPageViewPage page = new RadPageViewPage();
    page.Text = "New Page";
    pageView.SelectedPage = page;

Private Sub radPageView1_NewPageRequested(ByVal sender As Object, ByVal e As EventArgs)
    Dim pageView As RadPageView = TryCast(sender, RadPageView)
    Dim stripElement As RadPageViewStripElement = TryCast(pageView.ViewElement, RadPageViewStripElement)
    Dim page As New RadPageViewPage()
    page.Text = "New Page"
    pageView.SelectedPage = page
End Sub

The result is shown on the screenshot below:

WinForms RadPageView NewPageRequested Event Handler

See Also

In this article