My code currently adds this in the back end C#
deselectGridLink.GestureRecognizers.Add(NewTapGestureForUpdateCategories(false));
private TapGestureRecognizer NewTapGestureForUpdateCategories(bool val)
{
return new TapGestureRecognizer()
{
Command = new Command(() =>
{
App.DB.UpdateAllCategoryGroups(val);
App.DB.UpdateAllCategories(val);
GetPageData();
RemoveTableViewClickSection();
tableView.Root.Add(CreateTableSection());
SetPageDetails();
})
};
}
How can I add this in XAML with the parameter of false also included. Also if I somehow add this to XAML do I need to change the C#f NewTapGestureForUpdateCategories method?:
<Grid x:Name="deselectGridLink" VerticalOptions="CenterAndExpand" Padding="20, 0">
<Label TextColor="Blue" Style="{DynamicResource ListItemTextStyle}" x:Name="deselectLink" HorizontalOptions="StartAndExpand" VerticalOptions="Center" Text="Deselect All" />
</Grid>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" VerticalTextAlignment="Center" Text="{Binding UserName}" LineBreakMode="TailTruncation" TextColor="{StaticResource DarkTextColor}" FontSize="Medium" />
<Label Grid.Row="1" Grid.Column="0" VerticalTextAlignment="Center" Text="{Binding Mobile}" TextColor="{StaticResource DarkTextColor}" FontSize="Small" />
<Label Grid.Row="2" Grid.Column="0" VerticalTextAlignment="Center" Text="{Binding Email}" TextColor="{StaticResource DarkTextColor}" FontSize="Small" />
<Label Grid.Column="1" Grid.RowSpan="3" IsVisible="{Binding IsAdmin}" HorizontalOptions="Center" VerticalOptions="Center"
TextColor="Red" FontSize="Large"Text="" FontFamily="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free Regular">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Status_Clicked" CommandParameter="{Binding UserId}" />
</Label.GestureRecognizers>
</Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
async private void Status_Clicked(object sender, EventArgs e)
{
Label lblClicked = (Label)sender;
var item = (TapGestureRecognizer)lblClicked.GestureRecognizers[0];
var id=item.CommandParameter;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With