How to show Popup/Flyout at clicked item in ListView/GridView in Windows Store App

后端 未结 3 1134
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-05 11:21

I am working on a Windows Store App and would like to show some additional information about an Item that was clicked in ListView or GridView. This information should be sho

3条回答
  •  暖寄归人
    2021-01-05 11:30

    All you need to do is get DataContext:

    If You have list with items:

    MyList.ItemSource = new List();
    

    And in XAML:

    
      
      
        
          
          

    And in CodeBehind to access Item while click on the button on the list:

    private void AddClick(sender, args){
        var senderButton= (Button) sender;
        var item = (Item) sender.DataContext; //Item form the list
    }
    

    var item is whar you are looking for

提交回复
热议问题