locked
ListBox Item with Context Menu RRS feed

  • Question

  • Hi,

    I am creating Windows store app using Windows 8.1 and I want to show Contextmenu for each ListItem.

    Also on clicking on the ContextMenu I want to find out the ListItem for which it was fired.

    Is it possible to do so ?

    If yes how can I achieve it, please help.

    Thanks in advance!!


    Himanshu Nigam

    Friday, November 8, 2013 6:29 AM

Answers

  • Hi  HimanshuNigam,

    I can hardly come out a ListBox solution for you, but to set a event on ListBoxItem is possible.

    <ListBoxItem RightTapped="RightTappedEvent">Test Reight Click</ListBoxItem>

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 11, 2013 7:38 AM
    Moderator

All replies

  • Hi HimanshuNigam,

    I don't think you will be able to get such data, there is no API provided by PopupMenu class.

    But let's say we can always track what we've done, for instance when click on ListItem, use a temporal variable to record the item that clicked. ItemClickEventArgs class will tell you the source. Hope it can give you some idea.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, November 8, 2013 9:41 AM
    Moderator
  • Hi James,

    Thanks for your response.

    My requirement is when user clicks on ListItem it navigates to new page, whereas pressing and holding the ListItem opens a ContextMenu.

    So I am using Listbox.RightTapped event to show PopupMenu.

    I require the ListBoxItem so as to get its co-ordinate position and the datasource of this item tapped as it is needed further.

    Could you please provide any solution for this.


    Himanshu Nigam


    Monday, November 11, 2013 5:28 AM
  • Hi  HimanshuNigam,

    I can hardly come out a ListBox solution for you, but to set a event on ListBoxItem is possible.

    <ListBoxItem RightTapped="RightTappedEvent">Test Reight Click</ListBoxItem>

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 11, 2013 7:38 AM
    Moderator