0

I have a GridView, with a DataTemplate which is similar to the default one included in the W8.1 Grid App Template. It's populated (through binding) from a CollectionViewSource.

The GridView's SelectionMode is Single and I have subscribed to the GridView's SelectionChanged event. Inside this event, I can get the object that is currently selected by using this code -

private void itemGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
  ItemCanvas icDelete = ((GridView)sender).SelectedItem as ItemCanvas;
  string sName = icDelete.Name;
}

How can I access the DataTemplate of this item, i.e. how can I access the visual location of this item so I can show a Popup where this item is located in the GridView ?

Arctic Vowel
  • 1,492
  • 1
  • 22
  • 34

1 Answers1

1

I've done it by using a Flyout, my code:

My XAML:

   ...data template..
        <FlyoutBase.AttachedFlyout >
                                        <Flyout>
                                            <StackPanel>
                                                <MenuFlyoutItem x:Name="flag_" >
                                                <MenuFlyoutItem x:Name="hide_" >

                                                <TextBlock Width="200" x:Name="details" Text="{Binding title}"  />
                                            </StackPanel>
                                        </Flyout>
                                    </FlyoutBase.AttachedFlyout>

My C#:

   private void Border_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {

            Border brdr = sender as Border;
            FlyoutBase.ShowAttachedFlyout(brdr);

        }

And it's working great!

Nasser AlNasser
  • 1,725
  • 2
  • 11
  • 12