void InitializeContextMenu() { _autoFitContentMenuPopup = new Windows.UI.Xaml.Controls.Primitives.Popup(); AutoFillType[] items = new AutoFillType[4]; items[1] = AutoFillType.FillSeries; items[2] = AutoFillType.FillFormattingOnly; items[3] = AutoFillType.FillWithoutFormatting; _autoFitListBox = new DragFillContextMenu(items, AutoFillType.CopyCells); _autoFitListBox.SelectedAutoFitTypeChanged += new EventHandler(_autoFitListBox_SelectedAutoFitTypeChanged); }
/// <summary> /// Creates a new instance of the <see cref="T:DragFillContextMenuItem" /> class. /// </summary> /// <param name="text">The automatic drag fill context menu item text.</param> /// <param name="fillType">The automatic drag fill type that the menu item represents.</param> public DragFillContextMenuItem(string text, AutoFillType fillType) { base.DefaultStyleKey = typeof(DragFillContextMenuItem); PointerEntered += OnDragFillContextMenuItemPointerEntered; PointerExited += OnDragFillContextMenuItemPointerExited; PointerPressed += OnDragFillContextMenuItemPointerPressed; PointerReleased += OnDragFillContextMenuItemPointerReleased; Text = text; FillType = fillType; Loaded += DragFillContextMenuItem_Loaded; }
/// <summary> /// Creates a new instance of the <see cref="T:DragFillContextMenu" /> class. /// </summary> /// <param name="items">The automatic fill items.</param> /// <param name="defaultType">The default checked automatic fill item.</param> public DragFillContextMenu(AutoFillType[] items, AutoFillType defaultType) { base.DefaultStyleKey = typeof(DragFillContextMenu); _rootGrid = new StackPanel(); base.Content = _rootGrid; DragFillContextMenu menu = this; menu.Loaded += DragFillContextMenu_Loaded; _selectedType = defaultType; Items = items; DragFillContextMenu menu2 = this; menu2.PointerPressed += OnDragFillContextMenuPointerPressed; }
static string GetAutoFitTypeString(AutoFillType type) { switch (type) { case AutoFillType.CopyCells: return(ResourceStrings.UIFill_CopyCells); case AutoFillType.FillSeries: return(ResourceStrings.UIFill_FillSeries); case AutoFillType.FillFormattingOnly: return(ResourceStrings.UIFill_FillFormattingOnly); case AutoFillType.FillWithoutFormatting: return(ResourceStrings.UIFill_FillWithOutFormatting); } return(ResourceStrings.UIFill_None); }