protected void CreateTabControl(int row, int column)
        {
            _items = new System.Collections.ObjectModel.ObservableCollection <System.Collections.Generic.KeyValuePair <UserControl, IViewModel> >();

            TabHeaderControl = new OpenControls.Wpf.DockManager.Controls.TabHeaderControl();
            TabHeaderControl.SelectionChanged += _tabHeaderControl_SelectionChanged;
            TabHeaderControl.CloseTabRequest  += _tabHeaderControl_CloseTabRequest;
            TabHeaderControl.FloatTabRequest  += _tabHeaderControl_FloatTabRequest;
            TabHeaderControl.ItemsChanged     += _tabHeaderControl_ItemsChanged;
            TabHeaderControl.ItemsSource       = _items;
            TabHeaderControl.DisplayMemberPath = "Value.Title";
            Children.Add(TabHeaderControl);
            Grid.SetRow(TabHeaderControl, row);
            Grid.SetColumn(TabHeaderControl, column);
        }
Exemple #2
0
        internal static void DisplayItemsMenu(
            System.Collections.ObjectModel.ObservableCollection <System.Collections.Generic.KeyValuePair <UserControl, IViewModel> > items,
            OpenControls.Wpf.DockManager.Controls.TabHeaderControl tabHeaderControl,
            UserControl selectedUserControl)
        {
            ContextMenu contextMenu = new ContextMenu();
            int         i           = 0;

            foreach (var item in items)
            {
                MenuItem menuItem = new MenuItem();
                menuItem.Header           = item.Value.Title;
                menuItem.IsChecked        = item.Key == selectedUserControl;
                menuItem.CommandParameter = i;
                ++i;
                menuItem.Command = new Command(delegate { tabHeaderControl.SelectedIndex = (int)menuItem.CommandParameter; }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            contextMenu.IsOpen = true;
        }