本文整理汇总了C#中TabItem类的典型用法代码示例。如果您正苦于以下问题:C# TabItem类的具体用法?C# TabItem怎么用?C# TabItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabItem类属于命名空间,在下文中一共展示了TabItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TabItemIsEnabledPropertyUpdateTest
public void TabItemIsEnabledPropertyUpdateTest()
{
TabControl tabControl = new TabControl();
TabItem tabItem1 = new TabItem();
TabItem tabItem2 = new TabItem();
tabControl.Items.Add(tabItem1);
tabControl.Items.Add(tabItem2);
CreateAsyncTask(tabControl,
() => Assert.IsTrue(tabControl.IsEnabled),
() => Assert.IsTrue(tabItem1.IsEnabled),
() => Assert.IsTrue(tabItem2.IsEnabled),
() => tabItem1.IsEnabled = false,
() => tabControl.IsEnabled = false,
() => Assert.IsFalse(tabItem1.IsEnabled),
() => Assert.IsFalse(tabItem2.IsEnabled),
() => tabControl.IsEnabled = true,
() => Assert.IsFalse(tabItem1.IsEnabled),
() => Assert.IsTrue(tabItem2.IsEnabled)
);
EnqueueTestComplete();
}
示例2: CMSDesk_Default_OnTabCreated
protected TabItem CMSDesk_Default_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
// Ensure additional permissions to 'Content' tab
if (element.ElementName.ToLowerCSafe() == "content")
{
if (!IsUserAuthorizedPerContent())
{
exploreTreePermissionMissing = true;
return null;
}
}
else if (element.ElementName.ToLowerCSafe() == "ecommerce")
{
if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Ecommerce, ModuleEntry.ECOMMERCE))
{
return null;
}
}
else if (element.ElementName.ToLowerCSafe() == "onlinemarketing")
{
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.ONLINEMARKETING))
{
return null;
}
}
return tab;
}
示例3: Tabs_OnTabCreated
protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
switch (element.ElementName.ToLowerCSafe())
{
case "customers.customfields":
// Check if customer has any custom fields
FormInfo formInfo = FormHelper.GetFormInfo("ecommerce.customer", false);
if (!formInfo.GetFormElements(true, false, true).Any())
{
return null;
}
break;
case "customers.newsletters":
if (!ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER))
{
return null;
}
break;
case "customers.credit":
// Hide Credit tab for anonymous customer
if ((customerInfoObj == null) || !customerInfoObj.CustomerIsRegistered)
{
return null;
}
break;
}
return tab;
}
示例4: First_Tab_Should_Be_Selected_By_Default
public void First_Tab_Should_Be_Selected_By_Default()
{
TabItem selected;
var target = new TabControl
{
Template = new FuncControlTemplate<TabControl>(CreateTabControlTemplate),
Items = new[]
{
(selected = new TabItem
{
Name = "first",
Content = "foo",
}),
new TabItem
{
Name = "second",
Content = "bar",
},
}
};
target.ApplyTemplate();
Assert.Equal(0, target.SelectedIndex);
Assert.Equal(selected, target.SelectedItem);
}
示例5: tabControl_OnTabCreated
public TabItem tabControl_OnTabCreated(UIElementInfo uiElement, TabItem tab, int tabIndex)
{
switch (uiElement.ElementName.ToLowerCSafe())
{
case "tools":
// Hide "Tools" tab if none of modules is available (E-commerce or Contact management)
bool toolsAvailable = LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Ecommerce, ModuleEntry.ECOMMERCE) || LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContactManagement, ModuleEntry.ONLINEMARKETING);
if (!toolsAvailable)
{
return null;
}
break;
case "buy":
if (!LicenseKeyInfoProvider.OnlyTrialLicenseKeys)
{
return null;
}
break;
case "dashboard":
// Add hash to url
tab.RedirectUrl = URLHelper.ResolveUrl(URLHelper.EnsureHashToQueryParameters(uiElement.ElementTargetURL));
break;
}
return tab;
}
示例6: AddTab_Click
//*******************************************************
//
// The AddTab_Click server event handler is used to add
// a new security tab for this portal
//
//*******************************************************
protected void AddTab_Click(Object Sender, EventArgs e)
{
// Obtain PortalSettings from Current Context
PortalSettings portalSettings = (PortalSettings) Context.Items["PortalSettings"];
// New tabs go to the end of the list
TabItem t = new TabItem();
t.TabName = "New Tab";
t.TabId = -1;
t.TabOrder = 999;
portalTabs.Add(t);
// write tab to database
Configuration config = new Configuration();
t.TabId = config.AddTab(portalSettings.PortalId, t.TabName, t.TabOrder);
// reload the _portalSettings from the database
HttpContext.Current.Items["PortalSettings"] = new PortalSettings(portalSettings.PortalId, t.TabId);
// Reset the order numbers for the tabs within the list
OrderTabs();
// Redirect to edit page
Response.Redirect("~/Admin/TabLayout.aspx?tabid=" + t.TabId);
}
示例7: AddPage
public static void AddPage(TabControl tabControl, string tapName, Page page, bool maxSize = true)
{
if (maxSize)
{
page.Width = double.NaN;
page.Height = double.NaN;
page.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
page.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
}
Frame frame = new Frame();
if (maxSize)
{
frame.Width = double.NaN;
frame.Height = double.NaN;
frame.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
frame.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
}
frame.Content = page;
TabItem tabItem = new TabItem();
tabItem.Header = tapName;
tabItem.Content = frame;
tabControl.Items.Add(tabItem);
}
示例8: AddPages
public static void AddPages(TabControl tabControl, string tabName, bool maxSize, params Page[] pages)
{
Grid grid = new Grid();
grid.Width = double.NaN;
grid.Height = double.NaN;
grid.Margin = new Thickness(0);
grid.VerticalAlignment = VerticalAlignment.Top;
if (maxSize)
{
grid.HorizontalAlignment = HorizontalAlignment.Stretch;
grid.VerticalAlignment = VerticalAlignment.Stretch;
}
int index = 0;
foreach (var item in pages)
{
ColumnDefinition col = new ColumnDefinition();
col.Width = GridLength.Auto;
grid.ColumnDefinitions.Add(col);
SetPageToGrid(item, grid, 0, index);
index++;
}
TabItem tabItem = new TabItem();
tabItem.Header = tabName;
tabItem.Content = grid;
tabControl.Items.Add(tabItem);
}
示例9: InitalizeMenu
/// <summary>
/// Initializes workflow edit menu.
/// </summary>
protected void InitalizeMenu()
{
// General tab
TabItem general = new TabItem()
{
Text = GetString("general.general"),
RedirectUrl = "Workflow_General.aspx?workflowId=" + WorkflowId,
OnClientClick = "SetHelpTopic('helpTopic', 'workflow_general');"
};
SetTab(general);
// Steps tab
TabItem steps = new TabItem()
{
Text = GetString("Development-Workflow_Edit.Steps"),
RedirectUrl = CurrentWorkflow.IsBasic ? "Workflow_Steps.aspx?workflowId=" + WorkflowId : "Workflow_Designer.aspx?workflowId=" + WorkflowId,
OnClientClick = CurrentWorkflow.IsBasic ? "SetHelpTopic('helpTopic', 'workflow_steps');" : "SetHelpTopic('helpTopic', 'workflow_designer');"
};
SetTab(steps);
// Display additional tabs for document workflow
if (CurrentWorkflow.IsDocumentWorkflow)
{
// Hide if no site or no running site
if ((SiteInfoProvider.GetSitesCount() > 0))
{
// Scopes tab
TabItem scopes = new TabItem()
{
Text = GetString("Development-Workflow_Edit.Scopes"),
RedirectUrl = "Workflow_Scopes.aspx?workflowId=" + WorkflowId,
OnClientClick = "SetHelpTopic('helpTopic', 'workflow_scope');"
};
SetTab(scopes);
}
}
// E-mails tab
TabItem emails = new TabItem()
{
Text = GetString("Development-Workflow_Edit.Emails"),
RedirectUrl = "Workflow_Emails.aspx?workflowId=" + WorkflowId,
OnClientClick = "SetHelpTopic('helpTopic', 'workflow_emails');"
};
SetTab(emails);
// Display additional tabs for document workflow
if (CurrentWorkflow.IsDocumentWorkflow)
{
// Documents tab
TabItem docs = new TabItem()
{
Text = GetString("general.documents"),
RedirectUrl = "Workflow_Documents.aspx?workflowId=" + WorkflowId,
OnClientClick = "SetHelpTopic('helpTopic', 'workflow_documents');"
};
SetTab(docs);
}
}
示例10: Tabs_OnTabCreated
protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
int siteId = SiteID;
bool splitViewSupported = false;
string lowerElementName = element.ElementName.ToLowerCSafe();
// Skip some elements if editing just SKU without document binding
switch (lowerElementName)
{
case "products.relatedproducts":
if (NodeID <= 0)
{
return null;
}
break;
case "products.documents":
if ((NodeID <= 0) && DisplayTreeInProducts)
{
if (!CurrentUser.IsGlobalAdministrator || (sku == null) || !sku.IsGlobal)
{
return null;
}
}
break;
case "products.workflow":
case "products.versions":
splitViewSupported = true;
if ((NodeID <= 0) || (DocumentManager.Workflow == null))
{
return null;
}
break;
}
// Ensure tab preselection
if (lowerElementName.StartsWithCSafe("products.") && (lowerElementName.Substring("products.".Length) == selectedTab))
{
CurrentMaster.Tabs.SelectedTab = tabIndex;
}
// Add SiteId parameter to each tab
if (!string.IsNullOrEmpty(tab.RedirectUrl) && (siteId != CMSContext.CurrentSiteID))
{
tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", siteId.ToString());
}
// Ensure split view mode
if (splitViewSupported && CMSContext.DisplaySplitMode)
{
tab.RedirectUrl = GetSplitViewUrl(tab.RedirectUrl);
}
return tab;
}
示例11: TabItemDefaultValuesTest
public void TabItemDefaultValuesTest()
{
TabItem tabItem = new TabItem();
Assert.IsNull(tabItem.Header);
Assert.IsFalse(tabItem.IsSelected);
Assert.IsNull(tabItem.TestHook.TabControlParent);
}
示例12: SetIsEnabled
public void SetIsEnabled()
{
TabItem tabItem = new TabItem();
tabItem.IsEnabled = false;
Assert.IsFalse(tabItem.IsEnabled);
tabItem.IsEnabled = true;
Assert.IsTrue(tabItem.IsEnabled);
}
示例13: Tabs_OnTabCreated
protected TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
// Skip objects tab element if not have proper license
if ((element.ElementName.ToLowerCSafe() == "myrecyclebin.objects") && !LicenseKeyInfoProvider.IsFeatureAvailable(FeatureEnum.ObjectVersioning))
{
return null;
}
return tab;
}
示例14: Page_OnTabCreated
// TODO JaroslavK: Po presunuti prijde odstranit
protected TabItem Page_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
// Hide actions tab
if (element.ElementName.EqualsCSafe("Automation_actions", true) && !CurrentUser.IsGlobalAdministrator)
{
return null;
}
return tab;
}
示例15: Tabs_OnTabCreated
private TabItem Tabs_OnTabCreated(UIElementInfo element, TabItem tab, int tabIndex)
{
// Add SiteId parameter to each tab
if (!string.IsNullOrEmpty(tab.RedirectUrl))
{
tab.RedirectUrl = URLHelper.AddParameterToUrl(tab.RedirectUrl, "siteId", SiteID.ToString());
}
return tab;
}