private static Control MapQatDataToControl(VM.QatItem qatItem) { string typeName = qatItem.Instance.GetType().Name; Control control = null; switch (typeName) { case "ButtonData": { control = new RibbonButton(); control.DataContext = qatItem.Instance; break; } case "ToggleButtonData": { control = new RibbonToggleButton(); control.DataContext = qatItem.Instance; break; } case "RadioButtonData": { control = new RibbonRadioButton(); control.DataContext = qatItem.Instance; break; } case "CheckBoxData": { control = new RibbonCheckBox(); control.DataContext = qatItem.Instance; break; } case "TextBoxData": { control = new RibbonTextBox(); control.DataContext = qatItem.Instance; break; } case "MenuButtonData": { control = new RibbonMenuButton(); control.DataContext = qatItem.Instance; break; } case "SplitButtonData": { if (!qatItem.IsSplitHeader) { control = new RibbonSplitButton(); } else { VM.SplitButtonData splitButtonData = (VM.SplitButtonData)qatItem.Instance; if (splitButtonData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } control.DataContext = qatItem.Instance; break; } case "ComboBoxData": { control = new RibbonComboBox(); control.DataContext = qatItem.Instance; break; } case "MenuItemData": { VM.MenuItemData menuItemData = (VM.MenuItemData)qatItem.Instance; if (menuItemData.ControlDataCollection.Count > 0) { control = new RibbonMenuButton(); } else { control = new RibbonButton(); } control.DataContext = qatItem.Instance; break; } case "SplitMenuItemData": { VM.SplitMenuItemData splitMenuItemData = (VM.SplitMenuItemData)qatItem.Instance; if (!qatItem.IsSplitHeader) { if (splitMenuItemData.ControlDataCollection.Count > 0) { control = new RibbonSplitButton(); } else if (splitMenuItemData.IsCheckable) { control = new RibbonToggleButton(); } else { control = new RibbonButton(); } } else { control = new RibbonToggleButton(); } control.DataContext = qatItem.Instance; break; } case "GalleryData": { RibbonGallery gallery = new RibbonGallery(); RibbonMenuButton menuButton = new RibbonMenuButton(); menuButton.ItemsSource = new object[] { gallery }; control = menuButton; control.DataContext = qatItem.Instance; break; } case "GroupData": { control = new RibbonGroup(); control.DataContext = qatItem.Instance; break; } } return control; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.frameSistema = ((System.Windows.Controls.Frame)(target)); return; case 2: this.ramiOpciones = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target)); #line 25 "..\..\SystemWindow.xaml" this.ramiOpciones.Click += new System.Windows.RoutedEventHandler(this.ramiOpciones_Click); #line default #line hidden return; case 3: this.ramiExit = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target)); #line 26 "..\..\SystemWindow.xaml" this.ramiExit.Click += new System.Windows.RoutedEventHandler(this.ramiExit_Click); #line default #line hidden return; case 4: this.rmbProductos = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 31 "..\..\SystemWindow.xaml" this.rmbProductos.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.rmbProductos_MouseLeftButtonUp); #line default #line hidden #line 31 "..\..\SystemWindow.xaml" this.rmbProductos.GotFocus += new System.Windows.RoutedEventHandler(this.rmbProductos_GotFocus); #line default #line hidden return; case 5: this.rmbProveedores = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 48 "..\..\SystemWindow.xaml" this.rmbProveedores.GotFocus += new System.Windows.RoutedEventHandler(this.rmbProveedores_GotFocus); #line default #line hidden return; case 6: this.rmbGrupos = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 69 "..\..\SystemWindow.xaml" this.rmbGrupos.GotFocus += new System.Windows.RoutedEventHandler(this.rmbGrupos_GotFocus); #line default #line hidden return; case 7: this.rmbCursos = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 70 "..\..\SystemWindow.xaml" this.rmbCursos.GotFocus += new System.Windows.RoutedEventHandler(this.rmbCursos_GotFocus); #line default #line hidden return; case 8: this.rmbRecetas = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 71 "..\..\SystemWindow.xaml" this.rmbRecetas.GotFocus += new System.Windows.RoutedEventHandler(this.rmbRecetas_GotFocus); #line default #line hidden return; case 9: this.rmbSesiones = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 73 "..\..\SystemWindow.xaml" this.rmbSesiones.GotFocus += new System.Windows.RoutedEventHandler(this.rmbSesiones_GotFocus); #line default #line hidden return; case 10: this.rmbMedidas = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 78 "..\..\SystemWindow.xaml" this.rmbMedidas.GotFocus += new System.Windows.RoutedEventHandler(this.rmbMedidas_GotFocus); #line default #line hidden return; case 11: this.rmbPresentaciones = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 79 "..\..\SystemWindow.xaml" this.rmbPresentaciones.GotFocus += new System.Windows.RoutedEventHandler(this.rmbPresentaciones_GotFocus); #line default #line hidden return; case 12: #line 80 "..\..\SystemWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)).GotFocus += new System.Windows.RoutedEventHandler(this.RibbonMenuButton_GotFocus_1); #line default #line hidden return; case 13: #line 81 "..\..\SystemWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)).GotFocus += new System.Windows.RoutedEventHandler(this.RibbonMenuButton_GotFocus_2); #line default #line hidden return; case 14: this.rmbDocumentosIdentidad = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 82 "..\..\SystemWindow.xaml" this.rmbDocumentosIdentidad.GotFocus += new System.Windows.RoutedEventHandler(this.rmbDocumentosIdentidad_GotFocus); #line default #line hidden return; case 15: this.rmbTiposSesiones = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 83 "..\..\SystemWindow.xaml" this.rmbTiposSesiones.GotFocus += new System.Windows.RoutedEventHandler(this.rmbTiposSesiones_GotFocus); #line default #line hidden return; case 16: #line 84 "..\..\SystemWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)).GotFocus += new System.Windows.RoutedEventHandler(this.RibbonMenuButton_GotFocus_3); #line default #line hidden return; case 17: this.rmbCategorias = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 85 "..\..\SystemWindow.xaml" this.rmbCategorias.GotFocus += new System.Windows.RoutedEventHandler(this.rmbCategorias_GotFocus); #line default #line hidden return; case 18: this.rmbAreas = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 86 "..\..\SystemWindow.xaml" this.rmbAreas.GotFocus += new System.Windows.RoutedEventHandler(this.rmbAreas_GotFocus); #line default #line hidden return; case 19: this.rmbProgramas = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 87 "..\..\SystemWindow.xaml" this.rmbProgramas.GotFocus += new System.Windows.RoutedEventHandler(this.rmbProgramas_GotFocus); #line default #line hidden return; case 20: this.rmbCalculadora = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 94 "..\..\SystemWindow.xaml" this.rmbCalculadora.GotFocus += new System.Windows.RoutedEventHandler(this.rmbCalculadora_GotFocus); #line default #line hidden return; case 21: this.rmbWord = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 95 "..\..\SystemWindow.xaml" this.rmbWord.GotFocus += new System.Windows.RoutedEventHandler(this.rmbWord_GotFocus); #line default #line hidden return; case 22: this.rmbExcel = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); #line 96 "..\..\SystemWindow.xaml" this.rmbExcel.GotFocus += new System.Windows.RoutedEventHandler(this.rmbExcel_GotFocus); #line default #line hidden return; case 23: this.txbEmpresa = ((System.Windows.Controls.TextBlock)(target)); return; case 24: this.txbUsuario = ((System.Windows.Controls.TextBlock)(target)); return; case 25: this.txbFecha = ((System.Windows.Controls.TextBlock)(target)); return; case 26: this.txbHora = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
// RibbonGallery cannot be added to the QAT directly. Instead, the // RibbonGallery is wrapped inside a RibbonMenuButton when adding // it to the QAT. Here we create that RibbonMenuButton host and // transfer over interesting properties from the RibbonGallery to // the RibbonMenuButton host private static FrameworkElement WrapClone(FrameworkElement clone, bool allowTransformations) { if (allowTransformations && clone is RibbonGallery) { RibbonMenuButton wrapperButton = new RibbonMenuButton(); wrapperButton.Items.Add(clone); return wrapperButton; } return clone; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); // remove any old handlers if (_filterMenuButton != null) { Debug.Assert(_filterMenuButton.ItemContainerGenerator != null); _filterMenuButton.ItemContainerGenerator.StatusChanged -= OnFilterButtonItemContainerGeneratorStatusChanged; } _filterMenuButton = this.Template.FindName(_filterMenuButtonTemplatePartName, this) as RibbonMenuButton; if (_filterMenuButton != null) { Debug.Assert(_filterMenuButton.ItemContainerGenerator != null); _filterMenuButton.ItemContainerGenerator.StatusChanged += new EventHandler(OnFilterButtonItemContainerGeneratorStatusChanged); Binding itemsSourceBinding = new Binding() { Source = this._categoryFilters }; _filterMenuButton.SetBinding(RibbonMenuButton.ItemsSourceProperty, itemsSourceBinding); _filterMenuButton.Loaded += new RoutedEventHandler(filterMenuButton_Loaded); } _itemsPresenter = (ItemsPresenter)GetTemplateChild(ItemsHostName); _filterContentPane = GetTemplateChild(FilterContentPaneTemplatePartName) as ContentPresenter; _scrollViewer = GetTemplateChild(RibbonGallery.ScrollViewerTemplatePartName) as ScrollViewer; }
/// <summary> /// Initialize Automation Peer for RibbonButton /// </summary> public RibbonMenuButtonAutomationPeer(RibbonMenuButton owner) : base(owner) { }
private static void translateLabel(RibbonMenuButton button, string name, params string[] variables) { StringCollection str = Strings.getInterfaceString(name); if (str[StringType.Label].HasHotKey) { button.KeyTip = str[StringType.Label].HotKey; } button.Label = str[StringType.Label].interpret(variables); if (str.ContainsKey(StringType.ToolTip)) { button.ToolTip = str[StringType.ToolTip].interpret(variables); } }
private static void translateLabel(RibbonMenuButton button) { if (button.Label == null) return; string string_title = button.Label.ToString(); translateLabel(button, string_title); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mainWindow = ((DBManager.MainWindow)(target)); return; case 2: #line 34 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OpenFilterPopupCmdExecuted); #line default #line hidden #line 35 "..\..\..\MainWindow.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.OpenFilterPopupCmdCanExecute); #line default #line hidden return; case 3: this.dpMain = ((System.Windows.Controls.DockPanel)(target)); return; case 4: this.Ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target)); return; case 5: this.txtblkErrLogItemChanged = ((System.Windows.Controls.TextBlock)(target)); return; case 6: #line 71 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.rsmiAbout_Click); #line default #line hidden return; case 7: this.ramiExportToXls = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target)); #line 82 "..\..\..\MainWindow.xaml" this.ramiExportToXls.Click += new System.Windows.RoutedEventHandler(this.ExportToXlsCmdExecuted); #line default #line hidden return; case 8: this.ramiExportFromXls = ((Microsoft.Windows.Controls.Ribbon.RibbonApplicationMenuItem)(target)); #line 88 "..\..\..\MainWindow.xaml" this.ramiExportFromXls.Click += new System.Windows.RoutedEventHandler(this.CreateCompetitionCmdExecuted); #line default #line hidden return; case 9: this.ribtabMain = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target)); return; case 10: this.rbtnStartStop = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 99 "..\..\..\MainWindow.xaml" this.rbtnStartStop.Click += new System.Windows.RoutedEventHandler(this.StartCmdExecuted); #line default #line hidden return; case 11: #line 105 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.RefreshCmdExecuted); #line default #line hidden return; case 12: #line 111 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SyncDBWithFilesCmdExecuted); #line default #line hidden return; case 13: #line 116 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.DBToGridCmdExecuted); #line default #line hidden return; case 14: this.rmbtnGroup = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); return; case 15: this.rmbtnRound = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); return; case 16: this.rbtnOpenWorkbook = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 153 "..\..\..\MainWindow.xaml" this.rbtnOpenWorkbook.Click += new System.Windows.RoutedEventHandler(this.OpenWorkbookCmdExecuted); #line default #line hidden return; case 17: this.rchkShowGroupHead = ((Microsoft.Windows.Controls.Ribbon.RibbonCheckBox)(target)); #line 158 "..\..\..\MainWindow.xaml" this.rchkShowGroupHead.Click += new System.Windows.RoutedEventHandler(this.rchkShowGroupHead_Click); #line default #line hidden return; case 18: this.rchkAutoscrollEnabled = ((Microsoft.Windows.Controls.Ribbon.RibbonCheckBox)(target)); #line 163 "..\..\..\MainWindow.xaml" this.rchkAutoscrollEnabled.Checked += new System.Windows.RoutedEventHandler(this.rchkAutoscrollEnabled_CheckedUnchecked); #line default #line hidden #line 164 "..\..\..\MainWindow.xaml" this.rchkAutoscrollEnabled.Unchecked += new System.Windows.RoutedEventHandler(this.rchkAutoscrollEnabled_CheckedUnchecked); #line default #line hidden return; case 19: #line 170 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.PublishingSettingsCmdExecuted); #line default #line hidden return; case 20: #line 173 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.PublishResultsCmdExecuted); #line default #line hidden return; case 21: this.rbtnPublishResultsLogWindow = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 177 "..\..\..\MainWindow.xaml" this.rbtnPublishResultsLogWindow.Click += new System.Windows.RoutedEventHandler(this.PublishingLogCmdExecuted); #line default #line hidden return; case 22: this.rchkAutoPublishing = ((Microsoft.Windows.Controls.Ribbon.RibbonCheckBox)(target)); #line 180 "..\..\..\MainWindow.xaml" this.rchkAutoPublishing.Click += new System.Windows.RoutedEventHandler(this.rchkAutoPublishing_Click); #line default #line hidden return; case 23: this.ribtabConfig = ((Microsoft.Windows.Controls.Ribbon.RibbonTab)(target)); return; case 24: #line 191 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.SettingsCmdExecuted); #line default #line hidden return; case 25: this.rbtnLogWindow = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 197 "..\..\..\MainWindow.xaml" this.rbtnLogWindow.Click += new System.Windows.RoutedEventHandler(this.LogWindowCmdExecuted); #line default #line hidden return; case 26: this.rbtnShowRemoteControlWnd = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 203 "..\..\..\MainWindow.xaml" this.rbtnShowRemoteControlWnd.Click += new System.Windows.RoutedEventHandler(this.ShowRemoteControlWndCmdExecuted); #line default #line hidden return; case 27: this.rbtnFalsestartRules = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 208 "..\..\..\MainWindow.xaml" this.rbtnFalsestartRules.Click += new System.Windows.RoutedEventHandler(this.FalsestartRulesCmdExecuted); #line default #line hidden return; case 28: #line 216 "..\..\..\MainWindow.xaml" ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)).Click += new System.Windows.RoutedEventHandler(this.CalcGradesCmdExecuted); #line default #line hidden return; case 29: this.mbtnHighlightGrades = ((Microsoft.Windows.Controls.Ribbon.RibbonMenuButton)(target)); return; case 30: this.grdGroupHead = ((System.Windows.Controls.Grid)(target)); return; case 31: this.lblCompName = ((System.Windows.Controls.Label)(target)); return; case 32: this.lblLocation = ((System.Windows.Controls.Label)(target)); return; case 33: this.lblRoundDate = ((System.Windows.Controls.Label)(target)); return; case 34: this.lblRoundName = ((System.Windows.Controls.Label)(target)); return; case 35: this.lblMainJudge = ((System.Windows.Controls.Label)(target)); return; case 36: this.lblMainSecretary = ((System.Windows.Controls.Label)(target)); return; case 37: this.lblRow6 = ((System.Windows.Controls.Label)(target)); return; case 38: this.scrlvwrAdditionalDataGridHeader = ((System.Windows.Controls.ScrollViewer)(target)); return; case 39: this.spAdditionalDataGridHeader = ((System.Windows.Controls.StackPanel)(target)); return; case 40: this.lblLeftDummy = ((System.Windows.Controls.Label)(target)); return; case 41: this.lbRightDummy = ((System.Windows.Controls.Label)(target)); return; case 42: this.grdRoundMembersHost = ((System.Windows.Controls.Grid)(target)); #line 355 "..\..\..\MainWindow.xaml" this.grdRoundMembersHost.SizeChanged += new System.Windows.SizeChangedEventHandler(this.grdRoundMembersHost_SizeChanged); #line default #line hidden return; case 43: this.dgrdRoundMembers = ((System.Windows.Controls.DataGrid)(target)); #line 386 "..\..\..\MainWindow.xaml" this.dgrdRoundMembers.AddHandler(System.Windows.Controls.ScrollViewer.ScrollChangedEvent, new System.Windows.Controls.ScrollChangedEventHandler(this.dgrdRoundMembers_ScrollChanged)); #line default #line hidden #line 387 "..\..\..\MainWindow.xaml" this.dgrdRoundMembers.SizeChanged += new System.Windows.SizeChangedEventHandler(this.dgrdRoundMembers_SizeChanged); #line default #line hidden return; case 44: this.grdspltrRoundMembers = ((System.Windows.Controls.GridSplitter)(target)); return; case 45: this.dgrdRoundMembers2 = ((System.Windows.Controls.DataGrid)(target)); #line 422 "..\..\..\MainWindow.xaml" this.dgrdRoundMembers2.SizeChanged += new System.Windows.SizeChangedEventHandler(this.dgrdRoundMembers2_SizeChanged); #line default #line hidden return; case 46: this.RightPanel = ((DBManager.RightPanels.CRightPanelControl)(target)); return; } this._contentLoaded = true; }