1

I want to open popup by clicking on button in gridView element, inside popup I have three options by clicking on that option I want to navigate to another page with the id of the element

enter image description here

i want to open popup on click on button inside the gridView element my code looks like :-

<GridView x:Name="Test" Grid.Row="1" Margin="20,20,20,20" >
        <GridView.ItemTemplate>
            <DataTemplate>
                <Grid HorizontalAlignment="Left" Width="250" Height="250">
                    <Button Background="Red" HorizontalAlignment="Left" VerticalAlignment="Top" Height="100" Content="OpenPopup" Click="Button_PointerPressed"></Button>                     
                    <Popup x:Name="Mypopup">
                        <TextBlock Text="hi"/>
                    </Popup>                    
                    <StackPanel VerticalAlignment="Bottom" Background="{ThemeResource ListViewItemOverlayBackgroundThemeBrush}">
                        <TextBlock Text="{Binding Title}" Foreground="{ThemeResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextBlockStyle}" Height="60" Margin="15,0,15,0"/>
                        <TextBlock Text="{Binding Subtitle}" Foreground="{ThemeResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextBlockStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </GridView.ItemTemplate>
    </GridView>

on click event

 private void Button_PointerPressed(object sender, RoutedEventArgs e)
    {

        Mypopup.isopen = true;

    }

Error:-The name 'Mypopup' does not exist in the current context

I am a newbie.. so help me

Dinesh Tomer
  • 37
  • 1
  • 6

1 Answers1

0

All you have to do is on the Onclick event of your gridview's button do the following code :

popup.isopen = true

Then in your popup if you want to navigate to another page all you have to do is use Navigate on the proper event

Frame.Navigate(typeof(YourPage),YourID);

EDIT : If the buttons in your gridview are added through code and you want to do the event on those then make sure that they have different names such as : GrdButton1/GrdButton2 and then give them an event dynamicly

If they are added in the XAML then simply add it an event there

<Button x:Name="ButtonTest"
        Click="ButtonTest_Click"/>

If none of this answers your question please add more details to it

Community
  • 1
  • 1
micbobo
  • 862
  • 7
  • 24