Add another one to the "need this" list.
In the mean time, this is what I'm doing, and it seems to work ok for now.
First I call my ShowTab method setting the enabled property of the tab in question. Inside this method I also changed the tab's unselectedforecolor to give it the appearance of enabled or disabled.
private void ShowTab(String tabPage, Boolean tabVisible)
{
if (tabVisible)
{
tbsMain.Pages[tabPage].Enabled = true;
tbsMain.Pages[tabPage].TabUnselectedForeColor = Color.Black;
}
else
{
if (tbsMain.SelectedPage.Key == tabPage)
{
tbsMain.SelectedPage = tspDetails;
}
tbsMain.Pages[tabPage].Enabled = false;
tbsMain.Pages[tabPage].TabUnselectedForeColor = Color.LightGray;
}
}
Then, when the selectionchanging event fires, if the tab being selected is supposed to be disabled, I cancel the event.
private void tbsMain_SelectionChanging(object sender, TabStripPageCancelEventArgs e)
{
if (e.TabStripPage.Key == "tabProperties" && !e.TabStripPage.Enabled)
{
e.Cancel = true;
}
}
I agree that it's not the cleanest way to handle it, and I certainly hope this is fixed in the next release.
[Modified at 02/06/2006 07:57 PM]
[Modified at 02/06/2006 08:02 PM]