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


C# TabItem.SetBinding方法代码示例

本文整理汇总了C#中System.Windows.Controls.TabItem.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# TabItem.SetBinding方法的具体用法?C# TabItem.SetBinding怎么用?C# TabItem.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.TabItem的用法示例。


在下文中一共展示了TabItem.SetBinding方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Convert

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var source = (IEnumerable)value;
                if (source != null)
                {
                    var tabItems = new List<TabItem>();

                    foreach (object item in source)
                    {
                        var tabItem = new TabItem
                                          {
                                              DataContext = item,
                                              Content = new ContentControl { Template = (ControlTemplate)parameter }
                                          };

                        var binding = new Binding("DisplayName");
                        tabItem.SetBinding(TabItem.HeaderProperty, binding);

                        tabItems.Add(tabItem);
                    }

                    return tabItems;
                }
                return null;
            }
            catch (Exception)
            {
                return null;
            }
        }
开发者ID:ValdimarThor,项目名称:Cocktail,代码行数:32,代码来源:SourceToTabItemsConverter.cs

示例2: MakeNewTab

        private TabItem MakeNewTab(FileLoader currentLoader)
        {
            var newTab = new TabItem {DataContext = new FileData(currentLoader)};

            var headerBinding = new Binding("Name");
            headerBinding.Mode = BindingMode.OneTime;
            newTab.SetBinding(HeaderedContentControl.HeaderProperty, headerBinding);

            newTab.Content = new FileView();
            return newTab;
        }
开发者ID:owen-griffiths,项目名称:Experiments,代码行数:11,代码来源:MainWindow.xaml.cs

示例3: AddTab

        private void AddTab(UIElement content, string header)
        {
            var tabItem = new TabItem {
                Content = content,
                Header = header,
            };

            tabItem.SetBinding(VisibilityProperty, new Binding {
                Path = new PropertyPath(VisibilityProperty),
                Source = content
            });

            this.tabControl.Items.Add(tabItem);
        }
开发者ID:strager,项目名称:NoCap,代码行数:14,代码来源:SettingsWindow.xaml.cs

示例4: CreateTabItem

 private static TabItem CreateTabItem()
 {
     var tabItem = new TabItem
     {
         Width = 150,
         Height = 20,
         IsSelected = true,
         Content = CreateNewTab()
     };
     tabItem.SetBinding(HeaderedContentControl.HeaderProperty, new Binding("Content.DataContext.Title")
     {
         RelativeSource = RelativeSource.Self
     });
     return tabItem;
 }
开发者ID:hohogpb,项目名称:CefSharp,代码行数:15,代码来源:MainWindow.xaml.cs

示例5: AddTabItem

        private void AddTabItem(object vm)
        {
            var view = new ProviderView();
            var tab = new TabItem
            {
                DataContext = vm,
                Content = new ModernWPF.Controls.ModernContentControl { Content = view }
            };
            tab.SetBinding(TabItem.HeaderProperty, new Binding("Name"));

            theTabs.Items.Add(tab);

            // When there is only 1 Item, the tab can't be rendered without have it selected
            // Don't do Refresh(). This may clear
            // the Selected item, causing issue in the ViewModel
            if (theTabs.SelectedItem == null)
                tab.IsSelected = true;
        }
开发者ID:soukoku,项目名称:MExplorer,代码行数:18,代码来源:ShellWindow.xaml.cs

示例6: CreatePages

		private void CreatePages()
		{
			var layers = new TabItem()
				{
					Header = "Слои",
					Content = ElementsViewModel
				};
			Binding visibilityBinding = new Binding("SelectedPlan");
			visibilityBinding.Source = this;
			visibilityBinding.Converter = new NullToVisibilityConverter();
			layers.SetBinding(TabItem.VisibilityProperty, visibilityBinding);

			TabPages = new List<TabItem>()
			{
				layers
			};
			SelectedTabIndex = -1;
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:18,代码来源:PlansViewModel.PlanExtension.cs

示例7: AssociationsView_Loaded

        void AssociationsView_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            if (AssociationTabs.Items.Count == 0)
            {
                //Managed Profiles Tab
                TabItem profilesTab = new TabItem();
                profilesTab.Header = "Managed Profiles";
                ProfilesView profilesView = new ProfilesView();
                ProfilesViewModel profilesViewModel = KernelContainer.Kernel.Get<ProfilesViewModel>();
                profilesViewModel.AssociationManagerId = ViewModel.AssociationManagerId;
                profilesViewModel.BookingEnginePanel = BookingEnginePanel;
                profilesView.DataContext = profilesViewModel;
                profilesTab.Content = profilesView;

                //Saved Address Tab
                TabItem savedAddressTab = new TabItem();
                savedAddressTab.Header = "Saved Address";
                SavedAddressListView savedAddressListView = new SavedAddressListView();
                //SavedAddressListViewModel savedAddressListViewModel = KernelContainer.Kernel.Get<SavedAddressListViewModel>();
                //savedAddressListView.DataContext = savedAddressListViewModel;
                savedAddressTab.Content = savedAddressListView;

                TabItem savedBillingTab = new TabItem();
                savedBillingTab.Header = "Saved Billing";
                Segator.Loms.Modules.Associations.Silverlight.SavedBilling.BillingView savedBillingView = new Segator.Loms.Modules.Associations.Silverlight.SavedBilling.BillingView();
                //BillingViewModel savedBillingViewModel = KernelContainer.Kernel.Get<BillingViewModel>();
                //savedBillingView.DataContext = savedBillingViewModel;
                savedBillingTab.Content = savedBillingView;

                TabItem historyTab = new TabItem();
                historyTab.Header = "History";
                HistoryView historyView = new HistoryView();
                HistoryViewModel historyViewModel = KernelContainer.Kernel.Get<HistoryViewModel>();
                historyViewModel.BookingEnginePanel = BookingEnginePanel;
                historyView.DataContext = historyViewModel;

                historyTab.Content = historyView;

                TabItem myAwardsTab = new TabItem();
                myAwardsTab.Header = " Limo Points";
                MyAwardsView myAwardsView = new MyAwardsView();
                myAwardsTab.Content = myAwardsView;

                //My Admin Tab
                TabItem myAdminTab = new TabItem();
                myAdminTab.Header = "My Admin";
                MyAdminView myAdminView = new MyAdminView();
                MyAdminViewModel myAdminViewModel = KernelContainer.Kernel.Get<MyAdminViewModel>();
                myAdminViewModel.AssociationManagerId = ViewModel.AssociationManagerId;
                myAdminView.DataContext = myAdminViewModel;
                myAdminTab.Content = myAdminView;


                AssociationTabs.Items.Add(profilesTab);
                AssociationTabs.Items.Add(savedAddressTab);
                AssociationTabs.Items.Add(savedBillingTab);
                AssociationTabs.Items.Add(historyTab);
                AssociationTabs.Items.Add(myAwardsTab);
                AssociationTabs.Items.Add(myAdminTab);

                Binding b = new Binding("MyAdminTabVisibility");
                b.Source = DataContext;
                myAdminTab.SetBinding(TabItem.VisibilityProperty, b);
            }

        }
开发者ID:felixthehat,项目名称:Limo,代码行数:66,代码来源:AssociationsView.xaml.cs

示例8: OpenGraphInNewTab

        /// <summary>
        /// 
        /// </summary>
        /// <param name="seq_"></param>
        public void OpenGraphInNewTab(SequenceBase seq_)
        {
            foreach (TabItem item in tabControl.Items)
            {
                if ((item.DataContext as FlowGraphControlViewModel).ID == seq_.Id)
                {
                    tabControl.SelectedItem = item;
                    return;
                }
            }

            TabItem tab = new TabItem();
            FlowGraphControlViewModel fgvm = FlowGraphManager.Instance.GetViewModelByID(seq_.Id);
            tab.DataContext = fgvm;

            FlowGraphControl fgc = new FlowGraphControl();
            fgc.DataContext = fgvm;
            tab.Content = fgc;

            Binding bind = new Binding("Name");
            bind.Source = fgvm;
            tab.SetBinding(TabItem.HeaderProperty, bind);

            tabControl.SelectedIndex = tabControl.Items.Add(tab);
        }
开发者ID:xcasadio,项目名称:FlowGraph,代码行数:29,代码来源:FlowGraphManagerControl.xaml.cs

示例9: AddNewTab

        private void AddNewTab(IDirectoryView view, FileSystemBase fileSystem)
        {
            //create new TabItem & apply style
            TabItem ti = new TabItem();
            ti.Style = (Style)Resources["CloseableTabItem"];

            UserControl viewCtrl = (UserControl)view;
            viewCtrl.Height = double.NaN;//same as Auto in XAML
            viewCtrl.VerticalAlignment = VerticalAlignment.Stretch;
            viewCtrl.Width = double.NaN;
            viewCtrl.HorizontalAlignment = HorizontalAlignment.Stretch;

            //events
            view.ItemExecuted += ActiveView_ItemExecuted;

            //set file system
            if (fileSystem != null)
                view.ChangeFileSystem(fileSystem);

            //set content listview as content of tabitem
            ti.Content = view;

            //add tabitem to tabcontrol
            tcViews.Items.Insert(tcViews.Items.Count - 1, ti);
            tcViews.SelectedIndex = tcViews.Items.Count - 2;//QSTN: Why new tab must be selected, to gain header?

            //bind header
            Binding bind = new Binding("FileSystem.DirectoryName");
            bind.Source = view;
            ti.SetBinding(TabItem.HeaderProperty, bind);
        }
开发者ID:kkalinowski,项目名称:nex,代码行数:31,代码来源:DirectoryViewContainer.xaml.cs

示例10: CreateWorkerTabItem

		/// <summary>
		/// Creates the user interface elements for a Worker
		/// </summary>
		private void CreateWorkerTabItem( Worker worker )
		{
			// Create UI objects for this worker
			WorkerView view = new WorkerView();
			WorkerViewModel viewModel = new WorkerViewModel();
			TabItem tabItem = new TabItem();

			// Connect events, bindings and UI elements
			viewModel.InitializeBindings( worker ); ;
			view.DataContext = viewModel;
			tabItem.Header = viewModel.WorkerName;
			tabItem.Content = view;
			tabItem.DataContext = viewModel;
			tabItem.SetBinding( TabItem.HeaderProperty, "WorkerName" );

			// Add the Tab to the UI
			m_TabItemsDictionary[ worker ] = tabItem;
			TabItems.Add( tabItem );
		}
开发者ID:kjlowe,项目名称:wpf_mvvm_example,代码行数:22,代码来源:MainWindowViewModel.cs

示例11: CreatePages

        private void CreatePages()
        {
            var layers = new TabItem()
                {
                    Header = "Слои",
                    Content = ElementsViewModel
                };
            Binding visibilityBinding = new Binding("SelectedPlan");
            visibilityBinding.Source = this;
            visibilityBinding.Converter = (IValueConverter)Application.Current.FindResource("NullToVisibilityConverter");
            layers.SetBinding(TabItem.VisibilityProperty, visibilityBinding);

            TabPages = new List<TabItem>()
            {
                new TabItem()
                {
                    Header = "Планы",
                    Content = PlansTreeViewModel
                },
                layers
            };
        }
开发者ID:hjlfmy,项目名称:Rubezh,代码行数:22,代码来源:PlansViewModel.PlanExtension.cs

示例12: AddTabItem

        /// <summary>
        /// Adds <see cref="TabItem"/> for the content object
        /// </summary>
        /// <param name="item">Content of the <see cref="TabItems"/></param>
        private void AddTabItem(object item)
        {
            ContentControl contentControl = new ContentControl();
            TabItem tab = new TabItem
            {
                DataContext = item,
                Content = contentControl,
                HeaderTemplate = _tabControl.ItemTemplate
            };

            contentControl.SetBinding(ContentControl.ContentProperty, new Binding());
            tab.SetBinding(TabItem.HeaderProperty, new Binding());

            _tabControl.Items.Add(tab);
        }
开发者ID:harriganjames,项目名称:Finances,代码行数:19,代码来源:TabItemGeneratorBehavior.cs


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