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; }
private static bool NavigateDownToGallery(RibbonGallery gallery) { if (gallery != null) { if (gallery.CanUserFilter) { // Move focus to FilterContentPane of FilterMenuButton accordingly. FrameworkElement focusObject = null; ContentPresenter filterContentPane = gallery.FilterContentPane; if (filterContentPane != null && filterContentPane.IsVisible) { focusObject = filterContentPane; } if (focusObject == null) { RibbonMenuButton filterButton = gallery.FilterMenuButton; if (filterButton != null && filterButton.IsVisible) { focusObject = filterButton; } } if (focusObject != null) { focusObject.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); return true; } } RibbonGalleryCategory firstCategory = RibbonHelper.FindContainer(gallery, 0, 1, null, IsContainerVisible) as RibbonGalleryCategory; if (firstCategory != null) { return RibbonHelper.NavigateToFirstItem(firstCategory, /* BringIntoView callback */ null, IsContainerFocusable); } } return false; }
private static bool NavigateUpToGallery(RibbonGallery gallery) { if (gallery != null) { RibbonGalleryCategory lastCategory = RibbonHelper.FindContainer(gallery, gallery.Items.Count - 1, -1, null, IsContainerVisible) as RibbonGalleryCategory; if (lastCategory != null) { return RibbonHelper.NavigateToLastItem(lastCategory, /* BringIntoView callback */ null, IsContainerFocusable); } } return false; }
internal static bool NavigatePageAndHighlightRibbonGalleryItem(RibbonGallery gallery, RibbonGalleryItem galleryItem, FocusNavigationDirection direction) { RibbonGalleryItem highlightedGalleryItem; return NavigatePageAndHighlightRibbonGalleryItem(gallery, galleryItem, direction, out highlightedGalleryItem); }
// This method is called when trying to navigate pages within a RibbonGallery. // We approximate the RibbonGalleryItem that is a page away from the currently // focused item based upon the precomputed MaxColumnWidth and MaxRowHeight values. internal static bool NavigatePageAndHighlightRibbonGalleryItem( RibbonGallery gallery, RibbonGalleryItem galleryItem, FocusNavigationDirection direction, out RibbonGalleryItem highlightedGalleryItem) { highlightedGalleryItem = null; RibbonGalleryCategoriesPanel categoriesPanel = gallery.ItemsHostSite as RibbonGalleryCategoriesPanel; if (categoriesPanel != null) { double viewportWidth = categoriesPanel.ViewportWidth; double viewportHeight = categoriesPanel.ViewportHeight; RibbonGalleryCategory category, prevCategory = null; if (galleryItem != null) { category = galleryItem.RibbonGalleryCategory; } else { category = gallery.Items.Count > 0 ? gallery.ItemContainerGenerator.ContainerFromIndex(0) as RibbonGalleryCategory : null; galleryItem = category != null && category.Items.Count > 0 ? category.ItemContainerGenerator.ContainerFromIndex(0) as RibbonGalleryItem : null; } if (category != null) { Debug.Assert(category.RibbonGallery == gallery, "The reference RibbongalleryItem and the RibbonGallery must be related."); int startCatIndex = gallery.ItemContainerGenerator.IndexFromContainer(category); int endCatIndex, incr; if (direction == FocusNavigationDirection.Up) { endCatIndex = -1; incr = -1; } else { endCatIndex = gallery.Items.Count; incr = 1; } for (int catIndex = startCatIndex; catIndex != endCatIndex && highlightedGalleryItem == null; catIndex += incr) { category = gallery.ItemContainerGenerator.ContainerFromIndex(catIndex) as RibbonGalleryCategory; RibbonGalleryItemsPanel galleryItemsPanel = category.ItemsHostSite as RibbonGalleryItemsPanel; // We want to skip over filtered categories if (category.Visibility != Visibility.Visible) { continue; } int startItemIndex, endItemIndex, startColumnIndex, endColumnIndex, columnCount; columnCount = (int)(viewportWidth / galleryItemsPanel.MaxColumnWidth); if (direction == FocusNavigationDirection.Up) { startItemIndex = galleryItem != null ? category.ItemContainerGenerator.IndexFromContainer(galleryItem) : category.Items.Count - 1; endItemIndex = -1; if (prevCategory != null) { viewportHeight -= prevCategory.HeaderPresenter.ActualHeight; if (DoubleUtil.LessThanOrClose(viewportHeight, 0)) { highlightedGalleryItem = category.ItemContainerGenerator.ContainerFromIndex(startItemIndex) as RibbonGalleryItem; break; } } // startColumnIndex is the last column in the last row or the column of the anchor item if (columnCount == 1) { startColumnIndex = 0; endColumnIndex = 0; } else { startColumnIndex = (galleryItem != null ? startItemIndex : category.Items.Count - 1) % columnCount; endColumnIndex = 0; } } else { startItemIndex = galleryItem != null ? category.ItemContainerGenerator.IndexFromContainer(galleryItem) : 0; endItemIndex = category.Items.Count; if (prevCategory != null) { viewportHeight -= category.HeaderPresenter.ActualHeight; if (DoubleUtil.LessThanOrClose(viewportHeight, 0)) { highlightedGalleryItem = category.ItemContainerGenerator.ContainerFromIndex(startItemIndex) as RibbonGalleryItem; break; } } // endColumnIndex is the last column in the first row if (columnCount == 1) { startColumnIndex = 0; endColumnIndex = 0; } else { int remainingItems = category.Items.Count; bool isLastRow = remainingItems <= columnCount; startColumnIndex = galleryItem != null ? (startItemIndex % columnCount) : 0; endColumnIndex = isLastRow ? remainingItems - 1 : columnCount - 1; } } galleryItem = null; for (int itemIndex = startItemIndex, columnIndex = startColumnIndex; itemIndex != endItemIndex; itemIndex += incr) { if (columnIndex == endColumnIndex) { // We are at the end of a row viewportHeight -= galleryItemsPanel.MaxRowHeight; if (DoubleUtil.LessThanOrClose(viewportHeight, 0) || (itemIndex == endItemIndex - incr && catIndex == endCatIndex - incr)) { // If we have scrolled a page or have reached the boundary // of the gallery, highlight that item highlightedGalleryItem = category.ItemContainerGenerator.ContainerFromIndex(itemIndex) as RibbonGalleryItem; break; } if (direction == FocusNavigationDirection.Up) { if (columnCount > 1) { startColumnIndex = columnCount - 1; endColumnIndex = 0; } } else { if (columnCount > 1) { int remainingItems = category.Items.Count - itemIndex; bool isLastRow = remainingItems <= columnCount; startColumnIndex = 0; endColumnIndex = isLastRow ? remainingItems - 1 : columnCount - 1; } } columnIndex = startColumnIndex; } else { // We are interating through the cells in a row columnIndex += incr; } } prevCategory = category; } if (highlightedGalleryItem != null) { highlightedGalleryItem.IsHighlighted = true; return true; } } } return false; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 6 "..\..\..\MainWindow.xaml" ((CAGA.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.RibbonWindow_Closing); #line default #line hidden return; case 2: this.mainGrid = ((System.Windows.Controls.Grid)(target)); return; case 3: this.ribbon = ((Microsoft.Windows.Controls.Ribbon.Ribbon)(target)); return; case 4: this.RibbonMapGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 5: this.OpenMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 24 "..\..\..\MainWindow.xaml" this.OpenMapBtn.Click += new System.Windows.RoutedEventHandler(this.OpenMapBtn_Click); #line default #line hidden return; case 6: this.SaveMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 25 "..\..\..\MainWindow.xaml" this.SaveMapBtn.Click += new System.Windows.RoutedEventHandler(this.SaveMapBtn_Click); #line default #line hidden return; case 7: this.RibbonLayersGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 8: this.AddLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 29 "..\..\..\MainWindow.xaml" this.AddLayerBtn.Click += new System.Windows.RoutedEventHandler(this.AddLayerBtn_Click); #line default #line hidden return; case 9: this.RemoveLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 30 "..\..\..\MainWindow.xaml" this.RemoveLayerBtn.Click += new System.Windows.RoutedEventHandler(this.RemoveLayerBtn_Click); #line default #line hidden return; case 10: this.RibbonNavGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 11: this.PanMapBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Checked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Checked); #line default #line hidden #line 33 "..\..\..\MainWindow.xaml" this.PanMapBtn.Unchecked += new System.Windows.RoutedEventHandler(this.PanMapBtn_Unchecked); #line default #line hidden return; case 12: this.ZoomInBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Checked); #line default #line hidden #line 34 "..\..\..\MainWindow.xaml" this.ZoomInBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomInBtn_Unchecked); #line default #line hidden return; case 13: this.ZoomOutBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Checked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Checked); #line default #line hidden #line 35 "..\..\..\MainWindow.xaml" this.ZoomOutBtn.Unchecked += new System.Windows.RoutedEventHandler(this.ZoomOutBtn_Unchecked); #line default #line hidden return; case 14: this.ZoomToExtentBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 36 "..\..\..\MainWindow.xaml" this.ZoomToExtentBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToExtentBtn_Click); #line default #line hidden return; case 15: this.ZoomToPrevBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 37 "..\..\..\MainWindow.xaml" this.ZoomToPrevBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToPrevBtn_Click); #line default #line hidden return; case 16: this.ZoomToNextBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 38 "..\..\..\MainWindow.xaml" this.ZoomToNextBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToNextBtn_Click); #line default #line hidden return; case 17: this.ZoomToLayerBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 39 "..\..\..\MainWindow.xaml" this.ZoomToLayerBtn.Click += new System.Windows.RoutedEventHandler(this.ZoomToLayerBtn_Click); #line default #line hidden return; case 18: this.RibbonSelectionGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 19: this.SelectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonSplitButton)(target)); #line 42 "..\..\..\MainWindow.xaml" this.SelectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.SelectFeatureBtn_Click); #line default #line hidden return; case 20: this.SelectFeatureGallery = ((Microsoft.Windows.Controls.Ribbon.RibbonGallery)(target)); return; case 21: this.SelByRectItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 45 "..\..\..\MainWindow.xaml" this.SelByRectItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 22: this.SelByPolyItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 46 "..\..\..\MainWindow.xaml" this.SelByPolyItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 23: this.SelByCircleItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 47 "..\..\..\MainWindow.xaml" this.SelByCircleItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 24: this.SelByLineItem = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryItem)(target)); #line 48 "..\..\..\MainWindow.xaml" this.SelByLineItem.Selected += new System.Windows.RoutedEventHandler(this.SelectFeatureItem_Selected); #line default #line hidden return; case 25: this.SelectByGraphicsBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 52 "..\..\..\MainWindow.xaml" this.SelectByGraphicsBtn.Click += new System.Windows.RoutedEventHandler(this.SelectByGraphicsBtn_Click); #line default #line hidden return; case 26: this.UnselectFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 53 "..\..\..\MainWindow.xaml" this.UnselectFeatureBtn.Click += new System.Windows.RoutedEventHandler(this.UnselectFeatureBtn_Click); #line default #line hidden return; case 27: this.RibbonToolsGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 28: this.IdentifyFeatureBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Checked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Checked); #line default #line hidden #line 56 "..\..\..\MainWindow.xaml" this.IdentifyFeatureBtn.Unchecked += new System.Windows.RoutedEventHandler(this.IdentifyFeatureBtn_Unchecked); #line default #line hidden return; case 29: this.AttrTableBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 57 "..\..\..\MainWindow.xaml" this.AttrTableBtn.Click += new System.Windows.RoutedEventHandler(this.AttrTableBtn_Click); #line default #line hidden return; case 30: this.RibbonDrawingGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 31: this.DrawPolygonBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Checked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Checked); #line default #line hidden #line 60 "..\..\..\MainWindow.xaml" this.DrawPolygonBtn.Unchecked += new System.Windows.RoutedEventHandler(this.DrawPolygonBtn_Unchecked); #line default #line hidden return; case 32: this.RibbonDlgMgrGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 33: this.ToggleDlgBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 66 "..\..\..\MainWindow.xaml" this.ToggleDlgBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleDlgBtn_Click); #line default #line hidden return; case 34: this.RibbonSpeechRecGrp = ((Microsoft.Windows.Controls.Ribbon.RibbonGroup)(target)); return; case 35: this.ToggleSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 69 "..\..\..\MainWindow.xaml" this.ToggleSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.ToggleSpeechBtn_Click); #line default #line hidden return; case 36: this.SimSpeechBtn = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); #line 70 "..\..\..\MainWindow.xaml" this.SimSpeechBtn.Click += new System.Windows.RoutedEventHandler(this.SimSpeechBtn_Click); #line default #line hidden return; case 37: this.dockManager = ((AvalonDock.DockingManager)(target)); return; case 38: this.LayersPanel = ((AvalonDock.DockableContent)(target)); return; case 39: this.tocGrid = ((System.Windows.Controls.Grid)(target)); return; case 40: #line 84 "..\..\..\MainWindow.xaml" ((AvalonDock.DocumentPane)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.DocumentPane_SelectionChanged); #line default #line hidden return; case 41: this.MapPanel = ((AvalonDock.DocumentContent)(target)); return; case 42: this.mapGrid = ((System.Windows.Controls.Grid)(target)); return; case 43: this.LayoutPanel = ((AvalonDock.DocumentContent)(target)); return; case 44: this.layoutGrid = ((System.Windows.Controls.Grid)(target)); return; case 45: this.KinectCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 46: this.ColorDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 47: this.colorDisplay = ((System.Windows.Controls.Image)(target)); return; case 48: this.skeletonCanvas = ((System.Windows.Controls.Canvas)(target)); return; case 49: this.DepthDisplayPanel = ((AvalonDock.DockableContent)(target)); return; case 50: this.depthDisplay = ((System.Windows.Controls.Image)(target)); return; case 51: this.DevCtrlPanel = ((AvalonDock.DockablePane)(target)); return; case 52: this.statusTB = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public RibbonGalleryAutomationPeer(RibbonGallery owner) : base(owner) { }
internal RibbonGalleryDefaultFilterItemTemplateSelector(RibbonGallery inputGallery) : base() { _gallery = inputGallery; }
internal RibbonGalleryDefaultFilterItemContainerStyleSelector(RibbonGallery inputGallery) : base() { _gallery = inputGallery; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 40 "..\..\..\MainWindow.xaml" ((SBW2.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.RibbonWindowClosing); #line default #line hidden return; case 2: this.StartStopQAB = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); return; case 3: this.StartRB = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); return; case 4: this.StopRB = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); return; case 5: this.RestartRB = ((Microsoft.Windows.Controls.Ribbon.RibbonButton)(target)); return; case 6: this.Ribbon_Status = ((Microsoft.Windows.Controls.Ribbon.RibbonTwoLineText)(target)); return; case 7: this.MemStats = ((Microsoft.Windows.Controls.Ribbon.RibbonTwoLineText)(target)); return; case 8: this.Uptime = ((Microsoft.Windows.Controls.Ribbon.RibbonTwoLineText)(target)); return; case 9: this.memcb = ((Microsoft.Windows.Controls.Ribbon.RibbonComboBox)(target)); return; case 10: this.memboxGal = ((Microsoft.Windows.Controls.Ribbon.RibbonGallery)(target)); #line 103 "..\..\..\MainWindow.xaml" this.memboxGal.SelectionChanged += new System.Windows.RoutedPropertyChangedEventHandler<object>(this.MemoryComboBoxSelectionChanged); #line default #line hidden return; case 11: this.MemoryComboBox = ((Microsoft.Windows.Controls.Ribbon.RibbonGalleryCategory)(target)); return; case 12: this.NetworkToggle = ((Microsoft.Windows.Controls.Ribbon.RibbonToggleButton)(target)); #line 118 "..\..\..\MainWindow.xaml" this.NetworkToggle.Checked += new System.Windows.RoutedEventHandler(this.NetToggleChecked); #line default #line hidden #line 119 "..\..\..\MainWindow.xaml" this.NetworkToggle.Unchecked += new System.Windows.RoutedEventHandler(this.NetworkToggleUnchecked); #line default #line hidden return; case 13: this.outputBox = ((System.Windows.Controls.RichTextBox)(target)); return; case 14: this.inputBox = ((System.Windows.Controls.TextBox)(target)); #line 138 "..\..\..\MainWindow.xaml" this.inputBox.KeyDown += new System.Windows.Input.KeyEventHandler(this.TextBoxKeyDown); #line default #line hidden return; case 15: this.StartThumb = ((System.Windows.Shell.ThumbButtonInfo)(target)); return; case 16: this.StopThumb = ((System.Windows.Shell.ThumbButtonInfo)(target)); return; case 17: this.RestartThumb = ((System.Windows.Shell.ThumbButtonInfo)(target)); return; } this._contentLoaded = true; }