Exemple #1
0
        /// <summary>
        /// Handles the MouseRightButtonDown event for the Node
        /// </summary>
        /// <param name="args">Arguments for the event</param>
        public void NodeMouseRightButtonDownEventHandler(NodeViewModelMouseEventArgs<MouseButtonEventArgs> args)
        {
            // Ensure that the context menu has not already been initialized
                if (nodeContextMenu == null)
                {
                    nodeContextMenu = new ContextMenu();
                    nodeContextMenu.ItemsSource = nodeMenuItems;
                    nodeContextMenu.Opening += new RoutedEventHandler(NodeContextMenuOpeningHandler);
                    nodeContextMenu.Closed += new RoutedEventHandler(NodeContextMenuClosedHandler);
                }

                // Save the NodeViewModel that the right click was on
                targetNodeVM = args.NodeViewModel;

                // Open the Node's ContextMenu
                nodeContextMenu.OpenPopup(args.MouseArgs.GetPosition(null));
        }
Exemple #2
0
        /// <summary>
        /// Handles changes to the IsOpen DependencyProperty
        /// </summary>
        /// <param name="o">DependencyObject that changed</param>
        /// <param name="e">Event data for the DependencyPropertyChangedEvent</param>
        private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ContextMenu contextMenu = d as ContextMenu;

            contextMenu.OnIsOpenChanged((bool)e.OldValue, (bool)e.NewValue);
        }
Exemple #3
0
        /// <summary>
        /// Handles the MouseRightButtonDown event for the Graph
        /// </summary>
        /// <param name="args">Arguments for the event</param>
        public void GraphMouseRightButtonDownEventHandler(MouseButtonEventArgs args)
        {
            // Ensure that the context menu has not already been initialized
                if (graphContextMenu == null)
                {
                    graphContextMenu = new ContextMenu();
                    graphContextMenu.ItemsSource = graphMenuItems;
                    graphContextMenu.Opening += new RoutedEventHandler(GraphContextMenuOpeningHandler);
                }

                // Open the Graph's ContextMenu
                graphContextMenu.OpenPopup(args.GetPosition(null));
        }
Exemple #4
0
        /// <summary>
        /// Handles changes to the HorizontalOffset or VerticalOffset DependencyProperty
        /// </summary>
        /// <param name="o">DependencyObject that changed</param>
        /// <param name="e">Event data for the DependencyPropertyChangedEvent</param>
        private static void OnHorizontalVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ContextMenu contextMenu = d as ContextMenu;

            contextMenu.UpdateContextMenuPlacement();
        }