Inheritance: System.Windows.Controls.HeaderedItemsControl, IWeakEventListener
Ejemplo n.º 1
0
        private static object CoerceItemContainerStyle(DependencyObject d, object baseValue)
        {
            RibbonGalleryCategory category = (RibbonGalleryCategory)d;

            return(PropertyHelper.GetCoercedTransferPropertyValue(category,
                                                                  baseValue,
                                                                  ItemsControl.ItemContainerStyleProperty,
                                                                  category.RibbonGallery,
                                                                  RibbonGallery.GalleryItemStyleProperty));
        }
Ejemplo n.º 2
0
        // Coerce MinColumnCount to retrieve the value defined on parent Gallery if it's not set here locally.
        private static object CoerceMinColumnCount(DependencyObject d, object baseValue)
        {
            RibbonGalleryCategory me = (RibbonGalleryCategory)d;

            return(PropertyHelper.GetCoercedTransferPropertyValue(
                       me,
                       baseValue,
                       MinColumnCountProperty,
                       me.RibbonGallery,
                       RibbonGallery.MinColumnCountProperty));
        }
Ejemplo n.º 3
0
        // Coerce Max   ColumnCount to retrieve the value defined on parent Gallery if it's not set here locally.
        private static object CoerceMaxColumnCount(DependencyObject d, object baseValue)
        {
            RibbonGalleryCategory me = (RibbonGalleryCategory)d;
            int maxColumnCount       = (int)PropertyHelper.GetCoercedTransferPropertyValue(
                me,
                baseValue,
                MaxColumnCountProperty,
                me.RibbonGallery,
                RibbonGallery.MaxColumnCountProperty);

            if (maxColumnCount < (int)me.MinColumnCount)
            {
                return((int)me.MinColumnCount);
            }

            return(maxColumnCount);
        }
Ejemplo n.º 4
0
        private static void OnIsHighlightedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RibbonGalleryItem galleryItem = (RibbonGalleryItem)d;
            bool isHighlighted            = (bool)e.NewValue;

            RibbonGalleryCategory category = galleryItem.RibbonGalleryCategory;

            if (category != null)
            {
                RibbonGallery gallery = category.RibbonGallery;
                if (gallery != null)
                {
                    // Give the RibbonGallery a reference to this container and its data
                    object item = category.ItemContainerGenerator.ItemFromContainer(galleryItem);
                    gallery.ChangeHighlight(item, galleryItem, isHighlighted);
                }
            }
        }
Ejemplo n.º 5
0
        private static void OnNotifyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RibbonGalleryCategory galleryCategory = (RibbonGalleryCategory)d;

            galleryCategory.NotifyPropertyChanged(e);

            // This is for the layout related properties MinColumnCount/MaxColumnCount IsSharedColumnScope
            // and MaxColumnWidth on RibbonGallery/RibbonGalleryCategory. This calls InvalidateMeasure
            // for all the categories' ItemsPanel and they must use changed values.
            if (e.Property == MinColumnCountProperty || e.Property == MaxColumnCountProperty || e.Property == IsSharedColumnSizeScopeProperty || e.Property == ColumnsStretchToFillProperty)
            {
                RibbonGallery gallery = galleryCategory.RibbonGallery;
                if (gallery != null)
                {
                    gallery.InvalidateMeasureOnAllCategoriesPanel();
                }
            }
        }
 ///
 public RibbonGalleryCategoryAutomationPeer(RibbonGalleryCategory owner)
     : base(owner)
 {
 }
Ejemplo n.º 7
0
        private void SynchronizeWithCurrentItem(
            RibbonGalleryCategory category, 
            object selectedItem)
        {
            Debug.Assert(selectedItem != null, "Must have a selectedItem to synchronize with.");

            if (category != null)
            {
                // Synchronize currency on the category containing the SelectedItem
                MoveCurrentTo(category.CollectionView, selectedItem);

                // Synchronize currency on the gallery to be the category containing the SelectedItem
                MoveCurrentTo(CollectionView, ItemContainerGenerator.ItemFromContainer(category));
            }

            // Synchronize currency on the source CollectionView to be the SelectedItem
            int index = SourceCollectionView != null ? SourceCollectionView.IndexOf(selectedItem) : -1;
            if (index > -1)
            {
                MoveCurrentToPosition(SourceCollectionView, index);
            }
        }
Ejemplo n.º 8
0
        // To find out if the RibbonGallery contains the specified value
        // in any of the available items. If ignoreItemContainerGeneratorStatus
        // is true then skip the container generation check.
        private bool ContainsValue(
            object value,
            bool ignoreItemContainerGeneratorStatus,
            out object item, 
            out RibbonGalleryCategory category, 
            out RibbonGalleryItem galleryItem)
        {
            item = null;
            category = null;
            galleryItem = null;

            if (!ignoreItemContainerGeneratorStatus &&
                ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
            {
                return true;
            }

            ContentControl dummyElement = new ContentControl();

            foreach (object current in Items)
            {
                category = ItemContainerGenerator.ContainerFromItem(current) as RibbonGalleryCategory;
                if (category != null)
                {
                    for (int index=0; index<category.Items.Count; index++)
                    {
                        item = category.Items[index];
                        object itemValue = GetSelectableValueFromItem(item, dummyElement);
                        if (VerifyEqual(value, itemValue))
                        {
                            galleryItem = category.ItemContainerGenerator.ContainerFromIndex(index) as RibbonGalleryItem;
                            return true;
                        }
                        item = null;
                    }
                    category = null;
                }
            }

            return false;
        }
Ejemplo n.º 9
0
        // To find out if the RibbonGallery contains the specified item.
        // If ignoreItemContainerGeneratorStatus is true then skip the
        // container generation check.
        private bool ContainsItem(
            object item,
            bool ignoreItemContainerGeneratorStatus,
            out RibbonGalleryCategory category, 
            out RibbonGalleryItem galleryItem)
        {
            category = null;
            galleryItem = null;
            int index = -1;

            if (!ignoreItemContainerGeneratorStatus &&
                ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
            {
                return true;
            }

            foreach (object current in Items)
            {
                category = ItemContainerGenerator.ContainerFromItem(current) as RibbonGalleryCategory;
                if (category != null)
                {
                    index = category.Items.IndexOf(item);
                    if (index > -1)
                    {
                        galleryItem = category.ItemContainerGenerator.ContainerFromIndex(index) as RibbonGalleryItem;
                        break;
                    }
                    category = null;
                }
            }

            return index > -1;
        }
Ejemplo n.º 10
0
 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;
 }