Beispiel #1
0
 private void OnKeyUp(object sender, KeyEventArgs keyEventArgs)
 {
     if (keyEventArgs.Control && keyEventArgs.KeyCode == Keys.Return)
     {
         _barButtonItemSaveAndClose.PerformClick();
     }
 }
Beispiel #2
0
 private void _cbEdit(object sender, ExecutedRoutedEventArgs e)
 {
     _btn_Edit.PerformClick();
 }
Beispiel #3
0
 private void _cbDelete(object sender, ExecutedRoutedEventArgs e)
 {
     _btn_Delete.PerformClick();
 }
Beispiel #4
0
 private void _cbAdd(object sender, ExecutedRoutedEventArgs e)
 {
     _btn_Add.PerformClick();
 }
Beispiel #5
0
 public UC_Compendium()
 {
     _initializeComponents();
     _initShortcuts();
     _btn_Refresh.PerformClick();
 }
Beispiel #6
0
        private void DocGroup_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
        {
            if (ribbonControl.Categories.Count > 1)
            {
                ribbonControl.Categories.RemoveAt(1);
            }

            DocumentPanel panel = e.Item as DocumentPanel;

            if (panel == null)
            {
                return;
            }

            Page win = panel.Tag as Page;

            if (win == null)
            {
                return;
            }

            #region 合并ribbon菜单

            RibbonControl ribCtor = win.FindName("ribbonControl") as RibbonControl;
            if (ribCtor != null)
            {
                RibbonDefaultPageCategory pageCategory    = ribCtor.Categories.FirstOrDefault() as RibbonDefaultPageCategory;
                RibbonPageCategory        ribPageCategory = new RibbonPageCategory();
                ribPageCategory.Color   = Colors.Orange;
                ribPageCategory.Caption = pageCategory.Caption;
                ribbonControl.Categories.Add(ribPageCategory);

                foreach (RibbonPage page in pageCategory.Pages)
                {
                    RibbonPage newPage = new RibbonPage();
                    foreach (RibbonPageGroup group in page.Groups)
                    {
                        RibbonPageGroup newGroup = new RibbonPageGroup()
                        {
                            Caption = group.Caption
                        };
                        foreach (var item in group.Items)
                        {
                            if (item is BarButtonItem)
                            {
                                BarButtonItem btn    = item as BarButtonItem;
                                BarButtonItem newBtn = new BarButtonItem()
                                {
                                    Content     = btn.Content,
                                    RibbonStyle = btn.RibbonStyle,
                                    Glyph       = btn.Glyph,
                                    LargeGlyph  = btn.LargeGlyph,
                                    KeyGesture  = btn.KeyGesture,
                                };
                                newBtn.ItemClick += (s, arg) =>
                                {
                                    btn.Focusable = true;
                                    btn.Focus();       //TextBox 失去焦点后才反馈给绑定值
                                    btn.PerformClick();
                                };

                                Binding binding = new Binding()
                                {
                                    Source = btn, Path = new PropertyPath("IsEnabled")
                                };
                                BindingOperations.SetBinding(newBtn, IsEnabledProperty, binding);

                                binding = new Binding()
                                {
                                    Source = btn, Path = new PropertyPath("Visibility")
                                };
                                BindingOperations.SetBinding(newBtn, VisibilityProperty, binding);

                                newGroup.Items.Add(newBtn);
                            }
                        }
                        newPage.Groups.Add(newGroup);
                    }

                    newPage.Caption    = "工作栏";
                    newPage.IsSelected = true;
                    ribPageCategory.Pages.Add(newPage);
                }

                ribPageCategory.IsVisible = true;
            }

            ribbonControl.UpdateLayout();

            #endregion
        }
        public void ClickOnButton(IdentKey key)
        {
            BarButtonItem button = GetButtonByKey(key);

            button.PerformClick();
        }
Beispiel #8
0
 /// <summary>
 /// Activate the button item in question
 /// </summary>
 /// <param name="btnItem">The button item to activate</param>
 public void ActivateButton(BarButtonItem btnItem)
 {
     btnItem.PerformClick();
 }