本文整理汇总了C#中System.Windows.Controls.TabItem类的典型用法代码示例。如果您正苦于以下问题:C# TabItem类的具体用法?C# TabItem怎么用?C# TabItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TabItem类属于System.Windows.Controls命名空间,在下文中一共展示了TabItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainTab
public MainTab(int page, TabItem newTab, Image newVerso, Image newRecto, Grid canvas, Grid vGrid, Grid rGrid, Button delBtn, ScatterView SV, ScatterViewItem si, Grid vSwipeGrid, Grid rSwipeGrid, Grid vTranslationGrid, Grid rTranslationGrid, Grid vBoxesGrid, Grid rBoxesGrid, TextBlock headerText, SurfaceWindow1.language language)
{
_page = page;
_tab = newTab;
_verso = newVerso;
_recto = newRecto;
_canvas = canvas;
_vGrid = vGrid;
_rGrid = rGrid;
_SVI = si;
_delButton = delBtn;
numFingersRecto = 0;
numFingersVerso = 0;
fingerPos = new List<Point>();
avgTouchPoint = new Point(-1, 0);
_vSwipeGrid = vSwipeGrid;
_rSwipeGrid = rSwipeGrid;
_vTranslationGrid = vTranslationGrid;
_rTranslationGrid = rTranslationGrid;
_vBoxesGrid = vBoxesGrid;
_rBoxesGrid = rBoxesGrid;
_twoPage = true;
_SV = SV;
_headerTB = headerText;
_currentLanguage = language;
_previousLanguage = _currentLanguage;
_worker = new Workers(this);
}
示例2: CreateTabItem
public static TabItem CreateTabItem(WrapPanel headerPanel, Grid textBoxGrid)
{
TabItem tabItem = new TabItem();
tabItem.Header = headerPanel;
tabItem.Content = textBoxGrid;
return tabItem;
}
示例3: AddTabItem
private void AddTabItem(string header, UserControl aUserControl)
{
if (string.IsNullOrEmpty(header) || null == aUserControl)
{
return;
}
var list = this.planListTabControl.Items.Where(w => ((TabItem)w).Header.ToString() == header);
if (list.Count() > 0)
{
((TabItem)list.First()).Visibility = Visibility.Visible;
this.planListTabControl.SelectedItem = list.First();
}
else
{
TabItem tabItem = new TabItem();
tabItem.Header = header;
var tabContent = aUserControl;
tabItem.Content = tabContent;
this.planListTabControl.Items.Add(tabItem);
this.planListTabControl.SelectedItem = tabItem;
}
}
示例4: TabState
protected TabState()
{
var tabItem = new TabItem();
TabItem = tabItem;
TabItem.Header = this;
tabItem.DataContext = this;
}
示例5: MainWindow
public MainWindow()
{
InitializeComponent();
// initialize tabItem array
_tabItems = new List<TabItem>();
// add a tabItem with + in header
_tabAdd = new TabItem();
//get image for header and setup add button
_tabAdd.Style = new Style();
_tabAdd.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x30, 0x30, 0x30));
_tabAdd.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x30, 0x30, 0x30));
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(@"pack://application:,,,/Explore10;component/Images/appbar.add.png");
bitmap.EndInit();
Image plus = new Image();
plus.Source = bitmap;
plus.Width = 25;
plus.Height = 25;
_tabAdd.Width = 35;
_tabAdd.Header = plus;
_tabAdd.MouseLeftButtonUp += new MouseButtonEventHandler(tabAdd_MouseLeftButtonUp);
_tabItems.Add(_tabAdd);
// add first tab
//this.AddTabItem();
// bind tab control
tabDynamic.DataContext = _tabItems;
tabDynamic.SelectedIndex = 0;
}
示例6: 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);
}
}
示例7: AddTabItem
private TabItem AddTabItem()
{
int count = _tabcount;
Debug.WriteLine(count);
// create new tab item
var tab = new TabItem
{
Header = "C:\\",
Name = $"tab{count}",
HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate
};
var view = new ExploreView {Name = "Explore"};
view.FillView(@"C:\");
view.VerticalAlignment = VerticalAlignment.Stretch;
view.HorizontalAlignment = HorizontalAlignment.Stretch;
tab.Content = view;
// insert tab item right before the last (+) tab item
_tabItems.Insert(_tabItems.Count-1, tab);
_tabcount += 1;
return tab;
}
示例8: CreateTabHeader
private static FrameworkElement CreateTabHeader(TabItem tabItem, bool closeViewModelOnUnload)
{
Argument.IsNotNull("tabItem", tabItem);
var stackPanel = new StackPanel();
stackPanel.Orientation = Orientation.Horizontal;
var titleLabel = new Label();
titleLabel.Content = string.Format("Close on unload: {0}", closeViewModelOnUnload);
stackPanel.Children.Add(titleLabel);
var closeButton = new Button();
closeButton.Content = "X";
closeButton.ToolTip = "Close";
closeButton.Click += (sender, e) =>
{
var tabControl = tabItem.FindLogicalAncestorByType<System.Windows.Controls.TabControl>();
if (tabControl != null)
{
var tabItemAsIUserControl = tabItem.Content as IUserControl;
if ((tabItemAsIUserControl != null) && (tabItemAsIUserControl.ViewModel != null))
{
tabItemAsIUserControl.ViewModel.CloseViewModel(false);
}
tabControl.Items.Remove(tabItem);
}
};
stackPanel.Children.Add(closeButton);
return stackPanel;
}
示例9: JournalDetails
public JournalDetails(User user, int journalID)
: base(user, "Journal:" + journalID)
{
InitializeComponent();
Journal model = null;
if (journalID >= 0) {
var service = new SupportService(user);
model = service.GetJournal(journalID);
} else {
model = new Journal();
model.JournalID = -1;
model.FullName = "<New Journal>";
}
_viewModel = new JournalViewModel(model);
_traits = tabJournal.AddTabItem("Traits", new TraitControl(user, TraitCategoryType.Journal, _viewModel));
_notes = tabJournal.AddTabItem("Notes", new NotesControl(user, TraitCategoryType.Journal, _viewModel));
tabJournal.AddTabItem("Ownership", new OwnershipDetails(model));
if (_viewModel.JournalID >= 0) {
_viewModel.DataChanged += new DataChangedHandler(viewModel_DataChanged);
} else {
Loaded += new RoutedEventHandler(JournalDetails_Loaded);
_traits.IsEnabled = false;
_notes.IsEnabled = false;
}
ChangesCommitted += new PendingChangesCommittedHandler(JournalDetails_ChangesCommitted);
this.DataContext = _viewModel;
}
示例10: VisualisationDataControl
public VisualisationDataControl()
{
InitializeComponent();
VisualisationPlotControl ecgVPControl = new VisualisationPlotControl();
VisualisationTableControl ecgVTControl = new VisualisationTableControl();
VisualisationHistogramControl ecgVHControl = new VisualisationHistogramControl();
visulisationDataTabsList = new List<TabItem>();
TabItem ecgBaselineTab = new TabItem();
ecgBaselineTab.Header = "Plot";
ecgBaselineTab.Content = ecgVPControl;
visulisationDataTabsList.Add(ecgBaselineTab);
TabItem tableControl = new TabItem();
tableControl.Header = "Table";
tableControl.Content = ecgVTControl;
visulisationDataTabsList.Add(tableControl);
TabItem histogramControl = new TabItem();
histogramControl.Header = "Histogram";
histogramControl.Content = ecgVHControl;
visulisationDataTabsList.Add(histogramControl);
this.EcgDataDynamicTab.DataContext = visulisationDataTabsList;
}
示例11: InvokeAddTab
void InvokeAddTab(ChatUser friend, string message)
{
if (FindMatchingChatControl(friend.Summary.SteamId) != null) return;
if (!chatTabs.Dispatcher.CheckAccess())
chatTabs.Dispatcher.Invoke(() =>
{
var tabItem = new TabItem { Header = friend.Summary.PersonaName };
var chatControl = new ChatControl(this, tabItem, ChatHandler, friend);
tabItem.Content = chatControl;
chatTabs.Items.Add(tabItem);
if (!string.IsNullOrEmpty(message))
InvokeHandleMessage(chatControl, message);
chatTabs.SelectedIndex = chatTabs.Items.Count - 1;
});
else
{
var tabItem = new TabItem { Header = friend.Summary.PersonaName };
var chatControl = new ChatControl(this, tabItem, ChatHandler, friend);
tabItem.Content = chatControl;
chatTabs.Items.Add(tabItem);
if (!string.IsNullOrEmpty(message))
InvokeHandleMessage(chatControl, message);
chatTabs.SelectedIndex = chatTabs.Items.Count - 1;
}
}
示例12: Add_Tab_Button
private void Add_Tab_Button(object sender, RoutedEventArgs e)
{
TabItem item = new TabItem();
item.Content = new HorizontalSplitterBrowser();
item.Header = "Tab-" + this.tabControl.Items.Count.ToString("000");
this.tabControl.Items.Insert(this.tabControl.Items.Count-1, item);
}
示例13: AddTabItem
private void AddTabItem(string header, PlanListViewModel aPlanListViewModel)
{
if (string.IsNullOrEmpty(header) || null == aPlanListViewModel)
{
return;
}
var list = this.planListTabControl.Items.Where(w => ((TabItem)w).Header.ToString() == header);
if (list.Count() > 0)
{
((TabItem)list.First()).Visibility = Visibility.Visible;
this.planListTabControl.SelectedItem = list.First();
}
else
{
TabItem tabItem = new TabItem();
tabItem.Header = header;
PlanListStatisticsDataGrid planListDataGrid = new PlanListStatisticsDataGrid(aPlanListViewModel, null != planExtraEntity);
var tabContent = planListDataGrid as UserControl;
tabItem.Content = tabContent;
this.planListTabControl.Items.Add(tabItem);
this.planListTabControl.SelectedItem = tabItem;
}
}
示例14: Page1_Click
private void Page1_Click(object sender, RoutedEventArgs e)
{
const string tabName = "Transactions";
if (!TabExists(tabName))
{
TabItem tabitem = new TabItem();
tabitem.Header = tabName ;
Frame tabFrame = new Frame();
Transactions page1 = new Transactions();
tabFrame.Content = page1;
tabitem.Content = tabFrame;
tabitem.Name =tabName;
tabControlView.Items.Add(tabitem);
tabControlView.SelectedItem = tabitem;
}
else
{
List<TabItem> tabitem = (from TabItem item in tabControlView.Items
where item.Name.Equals(tabName)
select item).ToList();
if (tabitem.Any())
{
tabControlView.SelectedItem = tabitem.First();
}
}
//MessageBox.Show("Tab is Already Open or Too Many Tabs", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
示例15: AWindow
public AWindow(IWindow owner)
: base(owner, Core.settings)
{
TabItem from_me = new TabItem();
from_me.BeginInit();
from_me.EndInit();
this.Background = from_me.Background;
ProgressBar from_color = new ProgressBar();
default_progress_color = from_color.Foreground;
// Taskbar progress setup
TaskbarItemInfo = new TaskbarItemInfo();
// var uriSource = new Uri(System.IO.Path.Combine(Core.ExecutablePath, "masgau.ico"), UriKind.Relative);
System.Drawing.Icon ico = Properties.Resources.MASGAUIcon;
this.Icon = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
ico.ToBitmap().GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
if (owner != null) {
this.Owner = owner as System.Windows.Window;
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
} else {
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
}
}