Esempio n. 1
0
 private void SetFont(FontDialog fontDialog, OpenControls.Wpf.TabHeaderControl.TabHeaderControl tabHeaderControl)
 {
     tabHeaderControl.FontFamily = new FontFamily(fontDialog.Font.Name);
     tabHeaderControl.FontSize   = fontDialog.Font.Size * 96.0 / 72.0;
     tabHeaderControl.FontWeight = fontDialog.Font.Bold ? FontWeights.Bold : FontWeights.Regular;
     tabHeaderControl.FontStyle  = fontDialog.Font.Italic ? FontStyles.Italic : FontStyles.Normal;
 }
        protected void CreateTabControl(int row, int column)
        {
            _items = new System.Collections.ObjectModel.ObservableCollection <System.Collections.Generic.KeyValuePair <FrameworkElement, IViewModel> >();

            TabHeaderControl = new OpenControls.Wpf.TabHeaderControl.TabHeaderControl();
            TabHeaderControl.SelectionChanged += _tabHeaderControl_SelectionChanged;
            TabHeaderControl.CloseTabRequest  += _tabHeaderControl_CloseTabRequest;
            TabHeaderControl.FloatTabRequest  += _tabHeaderControl_FloatTabRequest;
            TabHeaderControl.ItemsChanged     += _tabHeaderControl_ItemsChanged;
            TabHeaderControl.TabMouseDown     += TabHeaderControl_TabMouseDown;
            TabHeaderControl.ItemsSource       = _items;
            TabHeaderControl.DisplayMemberPath = "Value.Title";
            Children.Add(TabHeaderControl);
            Grid.SetRow(TabHeaderControl, row);
            Grid.SetColumn(TabHeaderControl, column);
        }
Esempio n. 3
0
        internal static void DisplayItemsMenu(OpenControls.Wpf.TabHeaderControl.TabHeaderControl tabHeaderControl)
        {
            System.Windows.Controls.ContextMenu contextMenu = new System.Windows.Controls.ContextMenu();
            int i = 0;

            foreach (var item in tabHeaderControl.Items)
            {
                ViewModel.TabHeaderItem          tabHeaderItem = item as ViewModel.TabHeaderItem;
                System.Windows.Controls.MenuItem menuItem      = new System.Windows.Controls.MenuItem();
                menuItem.Header           = tabHeaderItem.HeaderText;
                menuItem.IsChecked        = item == tabHeaderControl.SelectedItem;
                menuItem.CommandParameter = i;
                ++i;
                menuItem.Command = new OpenControls.Wpf.Utilities.Command(delegate { tabHeaderControl.SelectedIndex = (int)menuItem.CommandParameter; }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            contextMenu.IsOpen = true;
        }
Esempio n. 4
0
        internal static void DisplayItemsMenu(
            System.Collections.ObjectModel.ObservableCollection <System.Collections.Generic.KeyValuePair <FrameworkElement, IViewModel> > items,
            OpenControls.Wpf.TabHeaderControl.TabHeaderControl tabHeaderControl,
            FrameworkElement 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 OpenControls.Wpf.Utilities.Command(delegate { tabHeaderControl.SelectedIndex = (int)menuItem.CommandParameter; }, delegate { return(true); });
                contextMenu.Items.Add(menuItem);
            }

            contextMenu.IsOpen = true;
        }