Preventing a User from Closing a Specific Tab

When tab closing enabled (see Tab Closing and Allowing Users to Close Tabs for more information), users can disable any tab on the strip by default. However, you can prevent users from closing a specific tab by setting that C1TabItem item's CanUserClose property to False.

In Design View

Complete the following steps:

1.   Select the tab that you wish to prevent users from closing.

2.   In the  Properties window, clear the CanUserClose check box.

In XAML

To prevent a user from closing a tab, add CanUserClose="False" to the <c1:C1TabItem> tag of the tab you want to prevent users from closing. The XAML will resemble the following:

 

<c1:C1TabItem CanUserClose="False"></c1:C1TabControl>

In Code

Complete the following steps:

1.   Open the Window1.xaml.cs page.

2.   Add the following code beneath the InitializeComponent() method:

      Visual Basic

      C#

3.   Run the program.


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.