Hi Furkan,
Thanks for using Syncfusion support.
We have checked the reported query from our end. We have prepared sample based on your requirement to change label color using tapgesture by command. We have prepared a sample based on your requirement for your reference, please find the sample below.
<ContentPage>
<sync:SfListView>
<sync:SfListView.ItemTemplate>
<DataTemplate>
<Grid>
<Label Text="{Binding BookName}" BackgroundColor="{Binding Color}"FontAttributes="Italic" FontSize="Small" HorizontalOptions="CenterAndExpand">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Path=BindingContext.TapCommand,Source={x:Reference Name=listView}}" CommandParameter="{Binding .}" />
</Label.GestureRecognizers>
</Label>
</Grid>
</DataTemplate>
</sync:SfListView.ItemTemplate>
</sync:SfListView>
</ContentPage>
|
You can change background color for label in viewmodel like below :
public ICommand TapCommand
{
get { return tapcommand; }
set { this.tapcommand = value; }
}
public BookInfoRepository()
{
TapCommand = new Command(OnTapped);
}
private void OnTapped(object obj)
{
var item = obj as BookInfo;
item.Color = Color.GreenYellow;
}
|
Please let us know whether sample meets your requirement.
Regards,
Gnana Priya N