private void ShowChart(IList <StockInfo> stocks) { string symbol = stocks[0].Symbol; if (stockChartTabDict.ContainsKey(symbol)) { // make the target tab selected for (int i = 0; i < this.chartTabs.Items.Count; i++) { var tab = this.chartTabs.Items[i] as TabItemExt; if (tab != null && tab.Header.Equals(symbol)) { this.chartTabs.SelectedIndex = i; break; } } return; } var chartView = new StockChartView(stocks); chartView.Rebind(); var chartTab = new TabItemExt(); chartTab.Header = symbol; chartTab.Content = chartView; this.chartTabs.Items.Add(chartTab); stockChartTabDict.Add(symbol, chartTab); }
/// <summary> /// Handles the CloseOtherTabs event of the DockingManager control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Syncfusion.Windows.Tools.Controls.CloseTabEventArgs"/> instance containing the event data.</param> private void DockingManager_CloseOtherTabs(object sender, CloseTabEventArgs e) { string closingtabs = ""; MessageBoxResult result = MessageBox.Show("Do you want to close the tabs? ", "Closing Tabs", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { for (int i = 0; i < e.ClosingTabItems.Count; i++) { TabItemExt tabitem = e.ClosingTabItems[i] as TabItemExt; if (tabitem.Content != null && (tabitem.Content as ContentPresenter) != null) { ContentPresenter presenter = tabitem.Content as ContentPresenter; if (presenter != null && presenter.Content != null) { closingtabs = closingtabs + "\n\t" + DockingManager.GetHeader(presenter.Content as DependencyObject); } } } Log.TextWrapping = TextWrapping.Wrap; Log.Text = Log.Text + "Closed Tabs" + " : " + closingtabs + "\n"; Scroll.ScrollToBottom(); } else if (result == MessageBoxResult.No) { e.Cancel = true; } }
public void AddDetail(UserControl detail, string name) { // make sure the passed in arguments are good Debug.Assert(detail != null, "UserControl detail is null"); Debug.Assert(name != null, "string name is null"); // locate the TabControl that the tab will be added to containerOK = (TabControlExt)this.FindName("containerOK"); //Debug.Assert(itemsTab != null, "can't find ItemsTab"); // add a tabItem with + in header // _tabAdd = new TabItem(); // _tabAdd.Header = "+"; // tabAdd.MouseLeftButtonUp += new MouseButtonEventHandler(tabAdd_MouseLeftButtonUp); _tabItems.Add(_tabAdd); // create and populate the new tab and add it to the tab control TabItemExt newTab = new TabItemExt(); newTab.Content = detail; newTab.Header = name; containerOK.Items.Add(newTab); _tabItems.Add(newTab); // display the new tab to the user; if this line is missing // you get a blank tab containerOK.SelectedItem = newTab; //containerOK.fil //containerOK.Items.Refresh }
/// <summary> /// Initialise a new instance of the <see cref="StrikePriceVolumeTab"/> class. /// </summary> /// <param name="tabItemStrikePriceVolume">The tab item using this user control as the content.</param> /// <param name="stockSymbolNameViewModel">The view model containing the data of stocks' symbols and corresponding names.</param> public StrikePriceVolumeTab(TabItemExt tabItemStrikePriceVolume, StockSymbolNameViewModel stockSymbolNameViewModel) { _tabItemStrikePriceVolume = tabItemStrikePriceVolume; _stockSymbolNameViewModel = stockSymbolNameViewModel; InitializeComponent(); InitialiseTab(); } // end constructor StrikePriceVolumeTab
} // end method WindowHome_OnClosing #endregion Control Events #region Private Methods /// <summary> /// Add a new tab to the specified tab control. /// </summary> private void AddNewTab() { var tabItemStrikePriceVolume = new TabItemExt { Header = Properties.Resources.TabItemStrikePriceVolume_Header_NewTab, IsTabStop = false, ItemToolTip = Properties.Resources.TabItemStrikePriceVolume_Header_NewTab, MaxWidth = Properties.Settings.Default.MaxTabItemWidth }; tabItemStrikePriceVolume.Content = new StrikePriceVolumeTab(tabItemStrikePriceVolume, _stockSymbolNameViewModel); TabControlStrikePriceVolume.Items.Add(tabItemStrikePriceVolume); } // end method AddNewTab
public void Execute(object parameter) { if (parameter != null && parameter is TabControlExt) { TabItemExt tabItemExt1 = new TabItemExt() { Header = "TabItem" + ((parameter as TabControlExt).Items.Count + 1), Content = new TextBlock() { Text = "This is the content of TabItem" + ((parameter as TabControl).Items.Count + 1) } }; (parameter as TabControlExt).Items.Add(tabItemExt1); } }
public void LoadWorkbook(IWorkbook Workbook) { tControl.Items.Clear(); gridModelCollection = GridModelImportExtensions.ImportFromExcelToVirtualGrid(Workbook); for (int i = 0; i < Workbook.Worksheets.Count; i++) { GridControl grid = new GridControl(); grid.Model = GridModelCollection[i]; grid.Model.ColumnWidths[0] = 35d; grid.Model.Options.WrapCell = false; grid.Model.Options.EnableFloatingCell = true; grid.Model.Options.ExcelLikeFreezePane = true; grid.Model.Options.ExcelLikeCurrentCell = true; grid.Model.Options.AllowExcelLikeResizing = true; grid.Model.Options.ExcelLikeSelectionFrame = true; grid.Model.CellModels.Add("SparkLineCell", new SparklineCellModel()); grid.Model.GraphicModel.CellModels.Add("Chart", new GraphicChartCellModel()); grid.Model.TableStyle.TextWrapping = TextWrapping.NoWrap; grid.Model.TableStyle.FloatCellMode = GridFloatCellsMode.OnDemandCalculation; grid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; grid.Model.Options.CopyPasteOption = CopyPaste.CopyText | CopyPaste.CutText | CopyPaste.PasteText; GridCommentService.SetShowComment(grid, true); BehaviorCollection GridBehaviors = Interaction.GetBehaviors(grid); GridBehaviors.Add(new GridCellImportingBehavior()); GridBehaviors.Add(new GridCellExportingBehavior()); GridBehaviors.Add(new CurrentCellEditingBehavior()); GridBehaviors.Add(new CellRequestNavigateBehavior()); GridBehaviors.Add(new CurrentCellSyncBehavior()); TabItemExt tab = new TabItemExt(); tab.Header = Workbook.Worksheets[i].Name; ScrollViewer sv = new ScrollViewer(); sv.CanContentScroll = true; sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; sv.Content = grid; tab.Content = sv; if (Workbook.Worksheets[i].Visibility != WorksheetVisibility.Visible) { tab.Visibility = System.Windows.Visibility.Collapsed; } tControl.Items.Add(tab); } tControl.SelectedIndex = 0; }
private void CloseCommandExecute(object obj) { string closingtabs = ""; WindowClosingEventArgs windowClosingEventArgs = obj as WindowClosingEventArgs; CloseTabEventArgs closeTabEventArgs = obj as CloseTabEventArgs; List <object> closingItems = null; if (closeTabEventArgs != null) { closingItems = closeTabEventArgs.ClosingTabItems.Select(a => a).ToList(); } MessageBoxResult result = MessageBox.Show("Do you want to close the tabs? ", "Closing Tabs", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { if (closeTabEventArgs != null && closingItems != null) { for (int i = 0; i < closingItems.Count; i++) { TabItemExt tabitem = closingItems[i] as TabItemExt; if (tabitem.Content != null && (tabitem.Content as ContentPresenter) != null) { ContentPresenter presenter = tabitem.Content as ContentPresenter; if (presenter != null && presenter.Content != null) { closingtabs = closingtabs + "\n\t" + DockingManager.GetHeader(presenter.Content as DependencyObject); } } } closingItems.Clear(); } else { closingtabs = closingtabs + "\n\t" + DockingManager.GetHeader(windowClosingEventArgs.TargetItem); } this.Text = this.Text + "Closed Tabs" + " : " + closingtabs + "\n"; } else if (result == MessageBoxResult.No) { (obj as CloseTabEventArgs).Cancel = true; } }
public void GidCellRequestNavigate(string SheetName, int RowIndex, int ColumnIndex) { TabItemExt tab = null; int modelcount = -1; foreach (TabItemExt item in tControl.Items) { modelcount++; if (item.Header.ToString() == SheetName) { tab = item; break; } } tControl.SelectedIndex = modelcount; GridControl gridctrl = ((tab.Content as ScrollViewer).Content as GridControl); if (tab != null && gridctrl != null && RowIndex > 0 && ColumnIndex > 0) { gridctrl.CurrentCell.MoveTo(RowIndex, ColumnIndex); gridctrl.CurrentCell.ScrollInView(); } }
protected override void OnAttached() { AssociatedObject.Loaded += (sender, e) => { TimeConsumingView control = sender as TimeConsumingView; TabControlExt tabcontrol = VisualUtils.FindAncestor(control as Visual, typeof(TabControlExt)) as TabControlExt; if (tabcontrol != null) { int index = tabcontrol.Items.IndexOf(control); if (index > -1 && index < tabcontrol.Items.Count && index == 0) { for (int i = 0; i < tabcontrol.Items.Count; i++) { TabItemExt item = tabcontrol.ItemContainerGenerator.ContainerFromIndex(i) as TabItemExt; if (item != null) { switch (i) { case 0: item.Header = "2006-2007"; break; case 1: item.Header = "2007-2008"; break; case 2: item.Header = "2008-2009"; break; case 3: item.Header = "2009-2010"; break; case 4: item.Header = "2010-2011"; break; case 5: item.Header = "2011-2012"; break; default: break; } } } } } if (!DesignerProperties.GetIsInDesignMode(new DependencyObject())) { DemoBrowserViewModel samplecontrol = null; if ((System.Windows.Application.Current.MainWindow.DataContext is DemoBrowserViewModel)) { samplecontrol = (System.Windows.Application.Current.MainWindow.DataContext as DemoBrowserViewModel); } if (control.reload.IsChecked.Value) { samplecontrol.IsProductDemoBusy = true; Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() => { control.Chart1.DataContext = new TestingViewModel(); control.Chart2.DataContext = new ChartViewModel(); samplecontrol.IsProductDemoBusy = false; isloaded = true; })); } else { if (!isloaded) { samplecontrol.IsProductDemoBusy = true; Dispatcher.BeginInvoke(DispatcherPriority.Normal, new ThreadStart(() => { control.Chart1.DataContext = new TestingViewModel(); control.Chart2.DataContext = new ChartViewModel(); samplecontrol.IsProductDemoBusy = false; isloaded = true; })); } } } }; }
//private void TreeViewItem_Selected(object sender, MouseButtonEventArgs e) private void TreeViewItem_Selected(object sender, RoutedEventArgs e) { try { TreeViewItem item = sender as TreeViewItem; if (item == e.OriginalSource) { var MultiTag = (TagMultiple)(sender as TreeViewItem).Tag; if (MultiTag.IsRep == true) { switch (MultiTag.typePnt) { case "1": //abre un tab interno de esta pantalla Syncfusion.Windows.Reports.Viewer.ReportViewer viewer = new Syncfusion.Windows.Reports.Viewer.ReportViewer(); viewer.ReportPath = MultiTag.urlRep; viewer.ReportServerUrl = MultiTag.serverIp; viewer.ProcessingMode = ProcessingMode.Remote; viewer.ReportServerCredential = new System.Net.NetworkCredential(MultiTag.userServer, MultiTag.userServerPass); List <DataSourceCredentials> crdentials = new List <DataSourceCredentials>(); foreach (var dataSource in viewer.GetDataSources()) { DataSourceCredentials credn = new DataSourceCredentials(); credn.Name = dataSource.Name; credn.UserId = "*****@*****.**"; credn.Password = "******"; crdentials.Add(credn); } viewer.SetDataSourceCredentials(crdentials); viewer.RefreshReport(); TabItemExt tabItemExt1 = new TabItemExt(); tabItemExt1.Header = MultiTag.NamePnt; tabItemExt1.Content = viewer; TabControlPricipal.Items.Add(tabItemExt1); break; case "3": dynamic ww = SiaWin.WindowExt(9531, "MenuReporteWindow"); ww.tipo = MultiTag.IsRep; ww.Server = MultiTag.serverIp; ww.UserServer = MultiTag.userServer; ww.UserServerPass = MultiTag.userServerPass; ww.carpeta = MultiTag.urlRep; ww.ShowInTaskbar = false; ww.Owner = Application.Current.MainWindow; ww.WindowStartupLocation = WindowStartupLocation.CenterScreen; ww.ShowDialog(); break; } } else { switch (MultiTag.typePnt) { case "2": //userconotrol reporte SiaWin.TabU(MultiTag.Id_screen); break; case "4": WebBrowser webPowBi = new WebBrowser(); string urlPowBi = MultiTag.urlRep; webPowBi.Navigate(urlPowBi); TabItemExt tabItemExtPowBi = new TabItemExt(); tabItemExtPowBi.Header = MultiTag.NamePnt; tabItemExtPowBi.Content = webPowBi; TabControlPricipal.Items.Add(tabItemExtPowBi); break; case "5": WebBrowser web = new WebBrowser(); string url = MultiTag.urlRep; web.Navigate(url); TabItemExt tabItemExt = new TabItemExt(); tabItemExt.Header = MultiTag.NamePnt; tabItemExt.Content = web; TabControlPricipal.Items.Add(tabItemExt); break; } } //item.IsSelected = false; //e.Handled = true; } } catch (Exception w) { MessageBox.Show("error en el select del item consulte con el administrador:" + w); } }
public void InitializeOrRefreshEverything(int tabIndex) { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; CurrentVisualStyle = Settings.Default.Theme; App.ThisIsNowConcurrent = false; App.ThisMadeLastChange = false; ResetGroupsBox.IsChecked = false; DeleteModeCheckBox.IsChecked = false; SearchField.Clear(); SearchField.AutoCompleteSource = SearchBoxAutoCompleteItems; MasterTabControl.Items.Clear(); var dataSets = App.MainSet(this); MasterDataSet = dataSets; MasterDataGrids.Clear(); EditedCells.Clear(); ProgressGrid.Visibility = Visibility.Hidden; using (var conn = new SqlConnection(App.ConnectionString)) { conn.Open(); foreach (string s in App.GetTableNames(conn)) { var tab = new TabItemExt { Header = s }; MasterTabControl.Items.Add(tab); } int i = 0; foreach (DataTable dt in MasterDataSet.Tables) { WriteToDataGrid(dt, App.GetPrefabOfDataTable(conn, dt), (TabItem)MasterTabControl.Items[i]); i++; } conn.Close(); } if (MasterTabControl.Items.Count > 0 && tabIndex < MasterTabControl.Items.Count) { MasterTabControl.SelectedIndex = tabIndex; } else if (tabIndex >= MasterTabControl.Items.Count) { MasterTabControl.SelectedIndex = MasterTabControl.Items.Count - 1; } else { MasterTabControl.SelectedIndex = 0; } RefreshRevertTables(); if (MasterTabControl.Items.Count < 1) { SearchField.IsEnabled = false; ResetSorts.IsEnabled = false; ResetGroupsBox.IsEnabled = false; DeleteModeCheckBox.IsEnabled = false; //RevertChanges.IsEnabled = false; NewRowButton.IsEnabled = false; RefreshAll.IsEnabled = false; BarcodeTextBox.IsEnabled = false; BarcodeInventoryCommit.IsEnabled = false; } else { SearchField.IsEnabled = true; ResetSorts.IsEnabled = true; ResetSorts.IsChecked = true; ResetGroupsBox.IsEnabled = true; DeleteModeCheckBox.IsEnabled = true; RefreshAll.IsEnabled = true; BarcodeTextBox.IsEnabled = true; BarcodeInventoryCommit.IsEnabled = true; NewRowButton.IsEnabled = true; } Recycled.FillRecycledDataTable(); System.Windows.Forms.Cursor.Current = Cursors.Default; }
private void CreateTabs(TabControl tabcontrol) { TabItemExt BasicShapesTab = new TabItemExt() { Header = "Basic Shapes", Background = new SolidColorBrush(Colors.Blue), }; Stencil BasicStencil = new Stencil() { ShowDisplayModeToggleButton = false, ShowSearchTextBox = false, ExpandMode = ExpandMode.All, Constraints = StencilConstraints.Default | StencilConstraints.AllowDragDrop }; BasicStencil.SymbolGroups = new SymbolGroups() { new SymbolGroupProvider() { MappingName = "Key", }, }; BasicStencil.Menu = new DiagramMenu() { MenuItems = new ObservableCollection <DiagramMenuItem>() { new DiagramMenuItem() { Content = "Cut", Command = StencilCommands.Cut, Icon = @"pack://*****:*****@"pack://application:,,,/Icons/Copy.png" }, new DiagramMenuItem() { Content = "Paste", Command = StencilCommands.Paste, CommandParameter = this, Icon = @"pack://*****:*****@"pack://application:,,,/Icons/Rename.png", }, }, }; BasicStencil.SymbolSource = new SymbolCollection() { new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Ellipse"], Key = "Basic Shapes", Menu = new DiagramMenu() { MenuItems = new ObservableCollection <DiagramMenuItem>() { new DiagramMenuItem() { Content = "Delete", Command = StencilCommands.Delete, CommandParameter = this, Icon = @"pack://application:,,,/Icons/Delete.png", }, }, }, }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Rectangle"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Plus"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Triangle"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Pentagon"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Hexagon"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Frame"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Donut"], Key = "Basic Shapes", }, new NodeViewModel() { UnitWidth = 100, UnitHeight = 100, Shape = this.Resources["Cube"], Key = "Basic Shapes", }, }; BasicShapesTab.Content = BasicStencil; tabcontrol.Items.Add(BasicShapesTab); }