Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to pass parameters to tapped event

$
0
0

Hi,

I am using the following Xamarin Code

<ListView ItemsSource="{Binding UserGroups}" RowHeight="66">
          <ListView.ItemTemplate>
            <DataTemplate>
              <ViewCell>
                <StackLayout Orientation="Horizontal" Spacing="10" Padding="10,10,10,10" TranslationX="10">
                  <Label
                    Text="{Binding Name}"
                    VerticalOptions="CenterAndExpand"  >
                    <Label.GestureRecognizers>
                      <TapGestureRecognizer  NumberOfTapsRequired="2" Tapped="OnEditGroupClicked" CommandParameter="{Binding Name}" />
                    </Label.GestureRecognizers>
                  </Label>
                 </StackLayout>
              </ViewCell>
            </DataTemplate>
          </ListView.ItemTemplate>
    </ListView>

Tapped event is firing, but sender and args are getting as unknown identifier, I am not able to figure out the issue

On Code behind file,

async void OnEditGroupClicked(object sender, EventArgs args)
{
// I want to access the Name
}

and sender and args are getting as unknown identifier

Can someone guide me the correct way to pass the parameter to tapped event

Thanks in Advance


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>