Reputation: 172
I want to be able to individually figure out which children grids are tapped as part of a larger grid. Each of the children grid are in individual columns and rows, I'm trying to do something simple where I handle individual grids being tapped through different event handlers. What am I doing wrong? I can only get the entire grid to fire an event handler when it is tapped, but what I want is the event handler "row0col0_Tapped" to be fired only when that part of the 0th row and 0th column of the outer grid is tapped.
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" IsTapEnabled="True">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid IsTapEnabled="True" Grid.Row="0" Grid.Column="0" Tapped="row0col0_Tapped">
<Canvas x:Name="row0col0"></Canvas>
</Grid>
<Grid IsTapEnabled="True" Grid.Row="0" Grid.Column="1"></Grid>
<Grid IsTapEnabled="True" Grid.Row="0" Grid.Column="2"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="0"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="1"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="2"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="0"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="1"></Grid>
<Grid IsTapEnabled="True" Grid.Row="2" Grid.Column="2"></Grid>
</Grid>
Upvotes: 0
Views: 1033
Reputation: 795
Please set a transparent back ground for the the grid which is to be tapped.
<Grid IsTapEnabled="True" Background="Transparent" Grid.Row="0" Grid.Column="0" Tapped="row0col0_Tapped">
<Canvas x:Name="row0col0"></Canvas>
</Grid>
Upvotes: 2