You could have the following in the code behind the form:
if (user.AccessLevel == AccessLevelEnum.Admin)
{
adminTab.Visibility = System.Windows.Visibility.Visible;
}
It should be noted that a User object named user has been created with it's AccessLevel property set to one of the user-defined enum values of AccessLevelEnum... whatever; it's just a condition by which I decide to show the tab or not.
I realize the question is old, and the accepted answer is old, but ...
At least in .NET 4.0 ...
To hide a tab:
To put it back:
TabPages
works so much better thanControls
for this.In WPF, it's pretty easy:
Assuming you've given the TabItem a name, e.g.,
You could have the following in the code behind the form:
It should be noted that a
User
object nameduser
has been created with it'sAccessLevel
property set to one of the user-defined enum values ofAccessLevelEnum
... whatever; it's just a condition by which I decide to show the tab or not.If you are talking about AjaxTabControlExtender then set TabIndex of every tabs and set Visible property True/False according to your need.
myTab.Tabs[1].Visible=true/false;
Just copy paste and try it,the above code has been tested in vs2010, it works.