private static void VerticalScrollOffsetPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { RibbonGallery g = (RibbonGallery)o; double value = (double)e.NewValue; g.OnVerticalScrollOffsetPropertychanged(value); }
int GetGalleryColumns(DependencyObject control, int level, int maxLevels) { RibbonGalleryColumns columns = RibbonGallery.GetReductionColumns(control); if (columns != null && columns.Count > 0) { level = Math.Max(0, Math.Min(level, columns.Count - 1)); return(columns[level]); } if (level == maxLevels) { return(0); } if (maxLevels > 4) { level = Math.Max(level, 8); return(3 + (4 - level / 2)); } else { return(3 + (2 - level) * 2); } }
private static void scrollDownCommand(object sender, ExecutedRoutedEventArgs e) { RibbonGallery gallery = (RibbonGallery)sender; //RoutedEventArgs args = new RoutedEventArgs(LaunchDialogEvent); //gallery.RaiseEvent(args); gallery.ScrollDown(); }
static void ReductionColumnsPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { RibbonGallery g = o as RibbonGallery; if (g != null) { RibbonGalleryColumns columns = e.NewValue as RibbonGalleryColumns; if (columns != null && columns.Count > 0) { g.Columns = columns[0]; } } }
protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { base.PrepareContainerForItemOverride(element, item); RibbonThumbnail tn = element as RibbonThumbnail; if (tn != null) { tn.Width = ThumbnailSize.Width; tn.Height = CalculateInRibbonThumbnailHeight(); Stretch stretch = RibbonGallery.GetStretch(this); RibbonGallery.SetStretch(tn, stretch); } }
protected override void OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) { base.OnMouseLeftButtonUp(e); // also close the poupup when the item is already selected: if (this.IsFocused) { RibbonGallery g = Gallery; if (g != null) { g.IsDropDownOpen = false; } } }
//Gets the maximum possible ReductionLevel that would change any of the controls. private int GetMaxLevel() { int max = 1; foreach (UIElement e in Controls) { if (e is IRibbonControl) { RibbonSizeCollection reduction = RibbonBar.GetReduction(e); int m = reduction != null ? reduction.Count : 3; max = Math.Max(max, m); } if (e is IRibbonGallery) { RibbonGalleryColumns columns = RibbonGallery.GetReductionColumns(e); int m = columns != null ? columns.Count : 3; max = Math.Max(max, m); } } return(max); }
public static void HotThumbnailPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { RibbonGallery g = (RibbonGallery)o; g.OnHotThumbnailChanged(e); }
public static void DropDownOpenPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { RibbonGallery g = (RibbonGallery)o; g.DropDownOpenChanged(e); }
public static void ColumnsPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { RibbonGallery g = (RibbonGallery)o; g.OnColumnsChanged(e); }