Beispiel #1
0
        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;
        }
Beispiel #2
0
        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;
            }
        }