当前位置: 首页>>代码示例>>C#>>正文


C# TabItem.Focus方法代码示例

本文整理汇总了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();
                }
            }
        }
开发者ID:brentedwards,项目名称:MvvmFabric,代码行数:28,代码来源:ViewPlacer.cs

示例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();
        }
开发者ID:SebiNano,项目名称:MetroWeb,代码行数:12,代码来源:MainWindow.xaml.cs

示例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;
 }
开发者ID:jkevinp,项目名称:ergoMC,代码行数:13,代码来源:ErgoMcApp.xaml.cs

示例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(); }));
        }
开发者ID:huoxudong125,项目名称:regex-tester,代码行数:14,代码来源:RegexTesterMain.xaml.cs

示例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;
        }
开发者ID:kevenme,项目名称:x-wall,代码行数:15,代码来源:MainWindow.xaml.cs

示例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();
            }
        }
开发者ID:brentedwards,项目名称:Movies,代码行数:23,代码来源:ViewController.cs

示例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();
        }
开发者ID:fjiang2,项目名称:sqlcon,代码行数:22,代码来源:SqlEditor.cs

示例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);
        }
开发者ID:KarimLUCCIN,项目名称:JNUI,代码行数:16,代码来源:MainWindow.xaml.cs

示例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();
                    }
                }
            }
        }
开发者ID:Nova-DK,项目名称:AuctionHouse,代码行数:34,代码来源:ClientWindow.xaml.cs

示例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;
            }
        }
开发者ID:gnoso,项目名称:razordb,代码行数:27,代码来源:MainWindow.xaml.cs

示例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();
        }
开发者ID:RichieYang,项目名称:RxSandbox,代码行数:24,代码来源:Window2.xaml.cs


注:本文中的System.Windows.Controls.TabItem.Focus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。