我的代码目前在后端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();
})
};
}
我如何在XAML中添加此内容,同时包含参数false。另外,如果我以某种方式将此内容添加到XAML中,是否需要更改C#f NewTapGestureForUpdateCategories方法?:
<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>
2条答案
按热度按时间w80xi6nr1#
第一个
9fkzdhlc2#
XAML文件:
后面的代码:
当你在Label.GestureRecognizers中设置CommandParameter上的值时,后面代码中的TapCommand可以接收它。