Hi Spencer,
Thank you for using syncfusion products.
#Regarding Changing image source on swipe based on items property
We would like to inform you that you can achieve your requirement with help of converter class in SfListview. Please refer to the following code snippet for your reference.
In mainpage.xaml
|
<syncfusion:SfListView.RightSwipeTemplate>
<DataTemplate>
<Grid>
<Grid BackgroundColor="#009EDA" HorizontalOptions="Fill" VerticalOptions="Fill" Grid.Column="0">
<Grid VerticalOptions="Center" HorizontalOptions="Center">
<Image Grid.Column="0"
Grid.Row="0"
BackgroundColor="Transparent"
HeightRequest="35"
WidthRequest="35"
Source="{Binding IsPaused,Converter={StaticResource converter}}" />
</Grid>
</Grid>
</Grid>
</DataTemplate>
</syncfusion:SfListView.RightSwipeTemplate> |
Inside the converter class, change the image source with help of bool value.
|
public class Converter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? ImageSource.FromResource("ListViewXamarin.Images.pause.jpg") : ImageSource.FromResource("ListViewXamarin.Images.play.jpg");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
} |
Please refer to the tested sample in the following link for your reference.
Please let us know if you have any concern.
Regards,
SaiGanesh Sakthivel