本文整理汇总了C#中System.Windows.Controls.TabControl类的典型用法代码示例。如果您正苦于以下问题:C# TabControl类的具体用法?C# TabControl怎么用?C# TabControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabControl类属于System.Windows.Controls命名空间,在下文中一共展示了TabControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Manager
//Editor Ed = new Editor(Edit);
public Manager(TabControl tabs, StackPanel Background, StackPanel Edit)
{
// TODO: Complete member initialization
this.tabs = tabs;
this.Background = Background;
this.Edit = Edit;
trSkw = new SkewTransform(0, 0);
trRot = new RotateTransform(0);
trTns = new TranslateTransform(0, 0);
trScl = new ScaleTransform(1, 1);
trSkw2 = new SkewTransform(0, 0);
trRot2 = new RotateTransform(0);
trTns2 = new TranslateTransform(0, 0);
trScl2 = new ScaleTransform(1, 1);
trGrp2 = new TransformGroup();
trGrp2.Children.Add(trSkw2);
trGrp2.Children.Add(trRot2);
trGrp2.Children.Add(trTns2);
trGrp2.Children.Add(trScl2);
trGrp = new TransformGroup();
trGrp.Children.Add(trSkw);
trGrp.Children.Add(trRot);
trGrp.Children.Add(trTns);
trGrp.Children.Add(trScl);
}
示例2: InfoAdorner
public InfoAdorner(TabControl target, DelphiAnalysis analysis)
: base(target)
{
if (analysis == null)
throw new ArgumentNullException("analysis");
this.analysis = analysis;
}
示例3: TabControlWorkSpace
public TabControlWorkSpace(TabControl tc)
{
if (tc == null) throw new ArgumentNullException("tc");
this._tabControl = tc;
this._tabControl.SelectionChanged += new SelectionChangedEventHandler(On_tabControl_SelectionChanged);
}
示例4: DocUITabbed
public DocUITabbed(XmlNode xmlNode, XmlSchemaAnnotated xsdNode, Panel contentpanel, Panel overlaypanel, DynamicForm parentForm)
: base(xmlNode, xsdNode, contentpanel, overlaypanel, parentForm)
{
this.Sideways = true;
_tabControl = new TabControl();
this.Control = _tabControl;
_optlist = new List<AbstractDocUIComponent>();
XmlSchemaElement schemaEl = xsdNode as XmlSchemaElement;
if (schemaEl != null)
{
XmlSchemaSequence seq = XmlSchemaUtilities.tryGetSequence(schemaEl.ElementSchemaType);
if (seq != null)
{
foreach (XmlSchemaElement el in seq.Items)
{
TabItem ti = new TabItem();
ti.Header = XmlSchemaUtilities.tryGetDocumentation(el); ;
Grid newpanel = new Grid();
ColumnDefinition cdnew1 = new ColumnDefinition();
cdnew1.Width = new GridLength(1, GridUnitType.Auto);
ColumnDefinition cdnew2 = new ColumnDefinition();
newpanel.ColumnDefinitions.Add(cdnew1);
newpanel.ColumnDefinitions.Add(cdnew2);
Utilities.recursive(el, xmlNode.SelectSingleNode(el.Name), newpanel, overlaypanel, (comp) =>
{
_optlist.Add(comp);
comp.placeOption();
}, parentForm);
ti.Content = newpanel;
this._tabControl.Items.Add(ti);
}
}
}
}
示例5: AddCustomTab
public void AddCustomTab(TabControl parentTabControl, string name, UserControl userControl, bool useViewBox = true)
{
if (useViewBox)
{
Viewbox viewBox = new Viewbox();
viewBox.Child = userControl;
viewBox.Width = double.NaN;
viewBox.Height = double.NaN;
TabItem tabItem = new TabItem();
tabItem.Header = name;
tabItem.Content = viewBox;
CopyFontData(tabItem1, tabItem);
parentTabControl.Items.Add(tabItem);
}
else
{
userControl.Width = double.NaN;
userControl.Height = double.NaN;
userControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
userControl.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
Grid grid = new Grid();
grid.Width = double.NaN;
grid.Height = double.NaN;
grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
grid.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
grid.Children.Add(userControl);
Grid.SetColumn(userControl, 0);
Grid.SetRow(userControl, 0);
AddCustomTab(parentTabControl, name, grid);
}
}
示例6: MainWindow
public MainWindow()
{
InitializeComponent();
ShowCurrentCulture();
AllowsTransparency = true;
_ucTabCharts = new ucTabCharts();
_solutionExplorer = new ucSolutionExplorer();
TabControl = _ucTabCharts.TabCharts;
GlobalData.MainWindow = this;
SetReceiveMessages();
var obj = Assembly.GetExecutingAssembly().GetName().Version;
_dataContext = IoC.Kernel.Get<IMainScreenViewModel>(new ConstructorArgument("token", Token));
DataContext = _dataContext;
_dataContext.ApplicationVersion = string.Format("{0}.{1}.{2}", obj.Minor, obj.Build, obj.Revision);
WindowsManagerCode();
Loaded += MainWindow_Loaded;
}
示例7: CloseDoesNotExist
public void CloseDoesNotExist()
{
CreateContainerWithRealMessageBus();
var title = Guid.NewGuid().ToString();
var viewModel = Substitute.For<ITitledViewModel>();
viewModel.Title.Returns(title);
var view = new FrameworkElement();
view.DataContext = viewModel;
var viewTarget = ViewTargets.DefaultView;
var viewResult = new ViewResult(view, viewTarget);
var viewBuilder = Substitute.For<IViewFactory>();
viewBuilder.Build(Arg.Any<ViewTargets>(), Arg.Any<Object>())
.Returns(viewResult);
ComponentContainer.Container.Register(Component.For<IViewFactory>().Instance(viewBuilder));
var window = new Window();
var tabControl = new TabControl();
var viewController = new ViewPlacer(window, tabControl);
var newTabItem = new TabItem() { Header = Guid.NewGuid().ToString() };
tabControl.Items.Add(newTabItem);
var message = new CloseViewMessage(title);
_MessageBus.Publish<CloseViewMessage>(message);
Assert.AreEqual(1, tabControl.Items.Count);
}
示例8: SetupArea
private void SetupArea(DockPosition position, ContentControl contentArea)
{
var extensionForThisArea = Extensions.Where(e => e.Metadata.Position == position).ToList();
if (extensionForThisArea.Count == 0)
{
contentArea.Visibility = System.Windows.Visibility.Collapsed;
}
else if (extensionForThisArea.Count == 1)
{
contentArea.Content = extensionForThisArea[0].Value;
}
else
{
TabControl tabControl = new TabControl();
foreach (var extension in extensionForThisArea)
{
var tabItem = new TabItem();
tabItem.Header = extension.Metadata.Name;
tabItem.Content = extension.Value;
tabControl.Items.Add(tabItem);
}
contentArea.Content = tabControl;
}
}
示例9: list_users_and_highlight
public void list_users_and_highlight(string username, bool highlight, TabControl tb)
{
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
new System.Action(() =>
{
if (highlight)
{
tb.SelectedIndex = 0;
this.users_list.populator.item_width = this.Width - 3;
this.users_list.populator.list_all_users_sync();
//configurations.SortItemGenericList(this.users_list._list.Items, false, false, true, configurations.users_num_desc.Length, configurations.users_date_desc.Length, true, true);
//this.header.atoz.IsChecked = false;
//this.header.recent.IsChecked = true;
//this.header.top.IsChecked = false;
//this.users_list._list.Items.Refresh();
//this.users_list._list.UpdateLayout();
}
item_generic_v2 i = find_item(username);
if (i == null) return;
ListBoxItem lbi = (ListBoxItem)(this.users_list._list.ItemContainerGenerator.ContainerFromItem(i));
if (highlight)
{
this.users_list._list.ScrollToCenterOfView(i);
i.Background = Brushes.Gray;
//double y = lbi.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0)).Y;
double x = 0;
if (this.users_list._list.Tag != null)
x = (double)this.users_list._list.Tag;
window_manager.open_collection_window((string)i.title.Text, (int)i.Tag, 65, x + 30);//lbi.PointToScreen(new Point(0,0)).Y);
}
else
i.Background = Brushes.White;
}));
}
示例10: SelectedIndex
public void SelectedIndex ()
{
TabItem item;
TabControl tabcontrol = new TabControl ();
Assert.AreEqual (null, tabcontrol.SelectedItem, "#1");
Assert.AreEqual (null, tabcontrol.SelectedContent, "#2");
Assert.AreEqual (-1, tabcontrol.SelectedIndex, "#3");
item = new TabItem ();
item.Header = new Rectangle { Width = 100, Height = 33, Fill = new SolidColorBrush (Colors.Red) };
item.Content = new Rectangle { Width = 100, Height = 100, Fill = new SolidColorBrush (Colors.Black) };
Assert.IsNull (item.Parent, "#4");
tabcontrol.Items.Add (item);
Assert.AreEqual (tabcontrol.Items [0], tabcontrol.SelectedItem, "#5");
Assert.AreEqual (((TabItem) tabcontrol.Items [0]).Content, tabcontrol.SelectedContent, "#6");
Assert.AreEqual (0, tabcontrol.SelectedIndex, "#7");
Assert.AreSame (item.Parent, tabcontrol, "#8");
item = new TabItem ();
item.Header = new Rectangle { Width = 100, Height = 33, Fill = new SolidColorBrush (Colors.Green) };
item.Content = new Rectangle { Width = 100, Height = 100, Fill = new SolidColorBrush (Colors.Brown) };
tabcontrol.Items.Add (item);
Assert.AreEqual (tabcontrol.Items [0], tabcontrol.SelectedItem, "#5b");
Assert.AreEqual (((TabItem) tabcontrol.Items [0]).Content, tabcontrol.SelectedContent, "#6b");
Assert.AreEqual (0, tabcontrol.SelectedIndex, "#7b");
Assert.AreSame (item.Parent, tabcontrol, "#8b");
item = new TabItem ();
item.Header = new Rectangle { Width = 100, Height = 33, Fill = new SolidColorBrush (Colors.Blue) };
item.Content = new Rectangle { Width = 100, Height = 100, Fill = new SolidColorBrush (Colors.Orange) };
tabcontrol.Items.Add (item);
}
示例11: SubnavigationButton
/// <summary>
/// Konstruktor für eine Seite mit TabControl
/// </summary>
/// <param name="label">Titel der Seite</param>
/// <param name="tabControl">anzuzeigender TabControl</param>
public SubnavigationButton(string label, TabControl tabControl)
{
this.isTabControl = true;
this.tabControl = tabControl;
this.label = label;
defineButton();
}
示例12: SideBar
// This constructor defines the look of the "new tab", which displays all apps for a user to choose from.
public SideBar(SurfaceWindow1 surfaceWindow, TabControl tabBar)
{
savedPages = new List<SavedPage>();
this.surfaceWindow = surfaceWindow;
this.tabBar = tabBar;
tabItems = new List<SideBarTab>();
tabAdd = new SideBarTab(this);
tabAdd.Header = "+";
tabAdd.Width = 50;
tabAdd.FontSize = 25;
tabAdd.FontFamily = new FontFamily("Cambria");
Canvas newTabCanvas = new Canvas();
newTabCanvas.Height = 900;
newTabCanvas.Width = 550;
tabAdd.Content = newTabCanvas;
newTabCanvas.Children.Add(addApplication("Search", "search.png", SearchButton_Selected, 100, 290, true));
newTabCanvas.Children.Add(addApplication("Annotate", "pencil.png", AnnotateButton_Selected, 100, 480, false));
newTabCanvas.Children.Add(addApplication("Saved Pages", "save.png", SavedPagesButton_Selected, 320, 480, false));
newTabCanvas.Children.Add(addApplication("Music", "music.png", StudyButton_Selected, 320, 290, true));
tabItems.Add(tabAdd);
tabBar.DataContext = tabItems;
tabBar.SelectedIndex = 0;
}
示例13: HtmlEditor
public HtmlEditor(WorkFrame frame)
: base(frame)
{
Panel = new TabControl();
Panel.Height = 640;
TabItem editTab = new TabItem();
editTab.Header = "编辑";
TextBox textBox = new TextBox();
textBox.DataContext = this;
var binding = new Binding("Value");
binding.Mode = BindingMode.TwoWay;
textBox.SetBinding(TextBox.TextProperty, binding);
editTab.Content = textBox;
TabItem viewTab = new TabItem();
viewTab.Header = "预览";
Browser = new WebBrowser();
viewTab.Content = Browser;
Panel.Items.Add(editTab);
Panel.Items.Add(viewTab);
Panel.SelectionChanged += panel_SelectionChanged;
Content = Panel;
}
示例14: LoadWebPartData
//modify by 安凯航.2011年9月5日
//如果radtileview有值则表示不进行初始化
private void LoadWebPartData()
{
if (radtileview == null)
{
radtileview = new TabControl();
//radtileview.MinimizedColumnWidth = new GridLength(310);
//RadTileViewItem item1 = new RadTileViewItem();
//item1.TileState = TileViewItemState.Minimized;
//item1.Header = "系统日志";
//item1.Content = new SystemLogger();
//radtileview.Items.Add(item1);
TabItem item2 = new TabItem();
//item2.TileState = TileViewItemState.Maximized;
item2.Header = "待办任务";
item2.Content = new SMT.SAAS.Platform.WebParts.Views.PendingTask();
radtileview.Items.Add(item2);
TabItem item5 = new TabItem();
//item5.TileState = Panel.Minimized;
item5.Header = "我的单据";
item5.Content = new SMT.SAAS.Platform.WebParts.Views.MyRecord();
radtileview.Items.Add(item5);
//RadTileViewItem item3 = new RadTileViewItem();
//item3.TileState = TileViewItemState.Minimized;
//item3.Header = "消息提醒";
//item3.Content = new SMT.SAAS.Platform.WebParts.Views.NoteRemind();
//radtileview.Items.Add(item3);
TabItem item4 = new TabItem();
//item4.TileState = TileViewItemState.Minimized;
item4.Header = "新闻动态";
item4.Content = new SMT.SAAS.Platform.WebParts.Views.News();
radtileview.Items.Add(item4);
//CheckeDepends("SMT.SaaS.OA.UI");
TabItem item6 = new TabItem();
//item6.TileState = TileViewItemState.Minimized;
item6.Header = "公司发文";
item6.Content = new SMT.SAAS.Platform.WebParts.Views.OAWebPart();
radtileview.Items.Add(item6);
Root.Children.Add(radtileview);
}
else
{
foreach (TabItem item in radtileview.Items)
{
IWebpart webPart = item.Content as IWebpart;
if (webPart != null)
{
webPart.Initialize();
}
}
}
}
示例15: CreateTabControl
public static TabControl CreateTabControl()
{
TabControl tabControl = new TabControl();
tabControl.HorizontalAlignment = HorizontalAlignment.Stretch;
tabControl.VerticalAlignment = VerticalAlignment.Stretch;
tabControl.Padding = new Thickness(2);
return tabControl;
}