/// <summary> /// Closes the gadget. /// </summary> public void CloseGadget() { DragCanvas dc = this.Parent as DragCanvas; Canvas parentCanvas = (Canvas)this.Parent; parentCanvas.Children.Remove((UIElement)this); dc.Cleanup(this as UserControl); }
private void dgCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { Point p = e.GetPosition(this); DragCanvas.SetLeft(popupMenu, p.X); DragCanvas.SetTop(popupMenu, p.Y); popupMenu.Show(); e.Handled = true; }
/// <summary> /// Closes the gadget. /// </summary> public void CloseGadget() { Canvas parentCanvas = (Canvas)this.Parent; DragCanvas dc = this.Parent as DragCanvas; dc.Cleanup(this as UserControl); parentCanvas.Children.Remove((UIElement)this); cEventHelper eh = new cEventHelper(); eh.RemoveAllEventHandlers(this); }
private void LayoutRoot_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (applicationViewModel.EwavDatasourceSelectedIndex < 0) //replaced 1 with 0 { ctxMenuCreator.DisplayWithOutDSSelected = true; } else { ctxMenuCreator.DisplayWithOutDSSelected = false; } Point p = e.GetSafePosition(dgCanvas); RemovePopup(); string tempGadgetName = dgCanvas.GadgetNameOnRightClick; Point contextMeneRightClickCoord = e.GetSafePosition(dgCanvas); if (contextMeneRightClickCoord.Y < 0) { return; } if (string.IsNullOrEmpty(tempGadgetName)) { popupMenu = ctxMenuCreator.CreateContextMenu("", contextMeneRightClickCoord, dgCanvas.StrataList, dgCanvas.SelectedGadget, dgCanvas, LayoutRoot, dgCanvas.Gridcells, dgCanvas.Gadgetparameters); } else { popupMenu = ctxMenuCreator.CreateContextMenu(tempGadgetName, contextMeneRightClickCoord, dgCanvas.StrataList, dgCanvas.SelectedGadget, dgCanvas, LayoutRoot, dgCanvas.Gridcells, dgCanvas.Gadgetparameters); } dgCanvas.AddChild(popupMenu, LayoutRoot); if (!ctxMenuCreator.PopupDisplayed) { ctxMenuCreator.PopupDisplayed = true; } DragCanvas.SetLeft(popupMenu, p.X); DragCanvas.SetTop(popupMenu, p.Y); popupMenu.Show(); //ScaleTransform st = new ScaleTransform(); //st.ScaleX = 2; //st.ScaleY = 2; //popupMenu.RenderTransform = st; if (dgCanvas.SelectedGadget != null) { UpdateZOrder((UIElement)dgCanvas.SelectedGadget, true); } UpdateZOrder(popupMenu, true); e.Handled = true; dgCanvas.GadgetNameOnRightClick = ""; // resetting the value to bring canvas context menu. if (DragCanvasRightMouseDownEvent != null) { DragCanvasRightMouseDownEvent(this); } if (spButtons.Visibility == System.Windows.Visibility.Visible && storyboardFlag == false) { //spButtons.Visibility = System.Windows.Visibility.Collapsed; Shrink.Begin(); storyboardFlag = true; } }
/// <summary> /// Event Handler for Send To Back Menu Click. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void mnuSendToBack_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { DragCanvas.SetZIndex((UIElement)SelectedGadget, -1); root.Children.Remove((UIElement)((Ewav.ContextMenu.MenuItem)sender).ParentMenu); HidePopuMenu(); }