Пример #1
0
 private static void DoOpenContextMenu(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Space || e.Key == Key.Enter)
     {
         AtrEditorHelper.OpenContextMenu(sender, e, false);
     }
 }
Пример #2
0
 private static void AttachSetValueCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is MenuItem)
     {
         d.SetValue(ButtonBase.CommandProperty, new DelegateCommand(() => AtrEditorHelper.DoSetValue((MenuItem)d, (string)e.NewValue)));
     }
 }
Пример #3
0
 private static void DoOpenPopup(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Space || e.Key == Key.Enter)
     {
         AtrEditorHelper.OpenPopup(sender, e);
     }
 }
Пример #4
0
        private static void OpenPopup(object sender, RoutedEventArgs e)
        {
            FrameworkElement Sender = (FrameworkElement)sender;
            DependencyPropertyChangedEventHandler VisibleChanged = null;

            Popup Popup = AtrEditorHelper.GetAttachPopupToImage(Sender);

            VisibleChanged = (placementTarget, _) =>
            {
                // ReSharper disable once AccessToModifiedClosure
                ((FrameworkElement)placementTarget).IsVisibleChanged -= VisibleChanged;
                Popup.IsOpen = false;
            };
            Sender.IsVisibleChanged += VisibleChanged;

            Popup.DataContext     = Sender.DataContext;
            Popup.PlacementTarget = Sender;
            Popup.Placement       = PlacementMode.Relative;
            Popup.StaysOpen       = false;
            Popup.IsOpen          = true;
            FocusManager.SetFocusedElement(Popup, Popup.GetVisualDescendantsDepthFirst <IInputElement>().FirstOrDefault());
            e.Handled = true;
        }
Пример #5
0
 private static void DoOpenContextMenu(object sender, MouseButtonEventArgs e)
 {
     AtrEditorHelper.OpenContextMenu(sender, e, true);
 }
Пример #6
0
 private static void DoOpenPopup(object sender, MouseButtonEventArgs e)
 {
     AtrEditorHelper.OpenPopup(sender, e);
 }