How to make a tappable frame in Xamarin Forms

To make an entire Xamarin Forms frame tappable, use a FrameGestureRecognizer, and set the Tapped property to your handler.  now the whole thing is tappable!   Inside your Frame Content, you can place a ListView that has multiple components.  For a visual cue, set an outline color on your Frame.  Place multiple Frames in a StackLayout or a Grid and you have a nice set of call to actions.

 <Frame Grid.Row="0" Grid.Column="0" OutlineColor="Gray">
          <Frame.GestureRecognizers>
            <TapGestureRecognizer Tapped="OnFrameTapped" />
          </Frame.GestureRecognizers>
          <Frame.Content>
            <StackLayout Orientation="Vertical" HorizontalOptions="Center">
              <ContentView HeightRequest="80" >
                <Image Source="image.png">
                </Image>
              </ContentView>
              <Label Text="My Frame" HorizontalOptions="Center"></Label>
            </StackLayout>
          </Frame.Content>
 </Frame>

Leave a Reply