本文整理汇总了C#中System.Windows.Controls.TabItem.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# TabItem.Focus方法的具体用法?C# TabItem.Focus怎么用?C# TabItem.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.TabItem
的用法示例。
在下文中一共展示了TabItem.Focus方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlaceView
public void PlaceView(ViewResult viewResult)
{
if (viewResult.ViewTarget == MoviesViewTargets.AdvancedSearch)
{
ModalViewPlacer.PlaceView(viewResult);
}
else
{
var exists = false;
var title = GetTitleFromViewModel(viewResult.View.DataContext);
foreach (TabItem tabItem in MainTabControl.Items)
{
if (tabItem.Header.ToString() == title)
{
exists = true;
break;
}
}
if (!exists)
{
var newTabItem = new TabItem() { Header = title, Content = viewResult.View };
MainTabControl.Items.Add(newTabItem);
newTabItem.Focus();
}
}
}
示例2: AddTab
public void AddTab(Uri URL)
{
TabItem myTab = new TabItem();
UserControlWebBrowserWindow myWebBrowserWindow = new UserControlWebBrowserWindow(myTab);
myWebBrowserWindow.WebBrowser.Navigate(URL);
myTab.Content = myWebBrowserWindow;
myTab.Header = "Untitled";
tabControlMain.Items.Add(myTab);
myTab.Focus();
}
示例3: AddFrame
public TabItem AddFrame(Page _window)
{
TabItem tabitem = new TabItem();
tabitem.Header = "Tab: " + _window.GetType().Name;
Frame tabFrame = new Frame();
_window.GetType();
tabitem.Tag = _window.GetType().Name;
tabFrame.Content = _window;
tabitem.Content = tabFrame;
TabControl.Items.Add(tabitem);
tabitem.Focus();
return tabitem;
}
示例4: AddNewTab
private void AddNewTab()
{
if (MainTabControl.Items.Count > 99)
{
MessageBox.Show("You open many tabs. Please close unnecessary.");
return;
}
TabItem newTab = new TabItem();
newTab.Header = GetTabItemName(MainTabControl);
newTab.Content = new RegexTesterPage();
MainTabControl.Items.Add(newTab);
Dispatcher.BeginInvoke(new Action(() => { newTab.Focus(); }));
}
示例5: checkSetting
bool checkSetting(bool result, TextBox textBox, string message, TabItem tab = null)
{
if (!result) {
MessageBox.Show(message, resources["Connect"] as string, MessageBoxButton.OK, MessageBoxImage.Warning);
if (tab != null) tab.Focus();
new Action(() => {
Dispatcher.BeginInvoke(new Action(() => {
textBox.SelectAll();
textBox.Focus();
}));
}).BeginInvoke(null, null);
}
return result;
}
示例6: HandleShowView
private void HandleShowView(ShowViewMessage args)
{
var viewFactory = ComponentContainer.Container.Resolve<IViewFactory>();
var viewResult = viewFactory.Build(args.ViewTarget, args.LoadArgs);
var exists = false;
foreach (TabItem tabItem in _MainTabControl.Items)
{
if (tabItem.Header.ToString() == viewResult.Title)
{
exists = true;
break;
}
}
if (!exists)
{
var newTabItem = new TabItem() { Header = viewResult.Title, Content = viewResult.View };
_MainTabControl.Items.Add(newTabItem);
newTabItem.Focus();
}
}
示例7: DisplayMessage
private void DisplayMessage(string message)
{
var fkColor = cfg.GetSolidBrush("gui.sql.result.message.Foreground", Colors.White);
var bkColor = cfg.GetSolidBrush("gui.sql.result.message.Background", Colors.Black);
var tab = new TabItem
{
Header = "Messages",
Content = new TextBox
{
Text = message,
Foreground = fkColor,
Background = bkColor,
IsReadOnly = true,
TextWrapping = TextWrapping.Wrap,
AcceptsReturn = true
}
};
tabControl.Items.Add(tab);
tab.Focus();
}
示例8: Plus_click
private void Plus_click(object sender, System.Windows.RoutedEventArgs e)
{
WebBrowser wb = new WebBrowser();
wb.Source = new Uri(homepage);
wb.LoadCompleted += new LoadCompletedEventHandler(Browser_loadCompleted);
TabItem tab = new TabItem();
tab.Content = wb;
tabControl.Items.Add(tab);
tab.Focus();
ongletControl oc = new ongletControl();
oc.TabUI = tabControl;
oc.TabIndex = tabControl.Items.Count -1;
uniformGrid.Children.Add(oc);
}
示例9: ItemsListBox_MouseDoubleClick
private void ItemsListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
{
if (ItemsListBox.SelectedItem != null)
{
TabItem ti = new TabItem();
var found = loti.FindIndex(x => x.Header == ItemsListBox.SelectedItem.ToString());
if (found < 0)
{
loti.Add(ti);
ti.Header = ItemsListBox.SelectedItem.ToString();
ScrollViewer sV = new ScrollViewer();
sV.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
ContextMenu cM = new ContextMenu();
MenuItem mI = new MenuItem();
mI.Name = "CloseTab";
mI.Header = "Close";
var er = new RoutedEventArgs();
mI.Click += new RoutedEventHandler(ContextMenuClickEventHandler);
cM.Items.Add(mI);
ti.ContextMenu = cM;
Room.Items.Add(ti);
ti.Focus();
}
else
{
loti[found].Focus();
}
}
}
}
示例10: OpenDatabase
private void OpenDatabase(string journalFile)
{
try {
var db = new DBController(journalFile, _factories);
var tab = new TabItem();
tab.Header = System.IO.Path.GetDirectoryName(journalFile).Split('\\').Last();
var ctxMenu = new ContextMenu();
var menuItem = new MenuItem();
menuItem.Header = "Close " + tab.Header;
menuItem.Click += new RoutedEventHandler((object sender, RoutedEventArgs e) => {
((DataViewControl)tab.Content).Close();
tabControl.Items.Remove(tab);
});
ctxMenu.Items.Add(menuItem);
tab.ContextMenu = ctxMenu;
var control = new DataViewControl { DBController = db };
tab.Content = control;
tabControl.Items.Add(tab);
tab.Focus();
} catch (Exception ex) {
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
示例11: item_MouseDoubleClick
private void item_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var definition = ((sender as TreeViewItem).Tag as ExpressionDefinition);
var instanceVM = new ExpressionInstanceVM(definition);
var control = new ExpressionControl {DataContext = instanceVM};
var item = new TabItem
{
Tag = definition.Name,
Header = definition.Name,
Content = control
};
EventHandler closeHandler = null;
closeHandler = (o, ea) =>
{
tabControl.Items.Remove(item);
instanceVM.CloseRequested -= closeHandler;
};
instanceVM.CloseRequested += closeHandler;
tabControl.Items.Add(item);
item.Focus();
}