Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Opening context menu just above item in win 8 metro app

Opening context menu just above item in win 8 metro app

Scheduled Pinned Locked Moved WPF
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nitin_ion
    wrote on last edited by
    #1

    I have a list of items defined in a ListView. When user click or tap any item, I want to show a PopupMenu just above the selected Item. How should I position the PopupMenu?

    varmenu =newPopupMenu();
    menu.Commands.Add(
    newUICommand("Remove", (x) =>
    {...
    // Create the message dialog and set its content
    }, 1));

    var chosenCommand =awaitmenu.ShowForSelectionAsync(GetElementRect((FrameworkElement)sender));

    Rect GetElementRect(FrameworkElement element)
    {
    GeneralTransform buttonTransform = element.TransformToVisual(null);
    Pointpoint = buttonTransform.TransformPoint(newPoint());
    returnnewRect(point,newSize(element.ActualWidth, element.ActualHeight));
    }

    S 1 Reply Last reply
    0
    • N nitin_ion

      I have a list of items defined in a ListView. When user click or tap any item, I want to show a PopupMenu just above the selected Item. How should I position the PopupMenu?

      varmenu =newPopupMenu();
      menu.Commands.Add(
      newUICommand("Remove", (x) =>
      {...
      // Create the message dialog and set its content
      }, 1));

      var chosenCommand =awaitmenu.ShowForSelectionAsync(GetElementRect((FrameworkElement)sender));

      Rect GetElementRect(FrameworkElement element)
      {
      GeneralTransform buttonTransform = element.TransformToVisual(null);
      Pointpoint = buttonTransform.TransformPoint(newPoint());
      returnnewRect(point,newSize(element.ActualWidth, element.ActualHeight));
      }

      S Offline
      S Offline
      Satish Pai
      wrote on last edited by
      #2

      Dear friend, Better way is use a context menu for the list & click on the list. Onn click event of the list ContextMenuService.GetContextMenu(listname).IsOpen = true; List_MouseRightButtonDown e.Handled = true; Hope this may help u Regards, Satish

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups