Changing Swipe Image at swipe time

HI,

Say I have a favourites swipe action which on click toggles a favourite for the row.

I want to show the correct image state for if its currently a favourite or not.

i.e.

<syncfusion:SfListView.StartSwipeTemplate>

    <DataTemplate x:Name="StartSwipeTemplate">
<Grid BackgroundColor="Red">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
Grid.ColumnDefinitions>
<Grid
Grid.Column="0"
BackgroundColor="#009EDA"
HorizontalOptions="Fill"
VerticalOptions="Fill">
<Grid HorizontalOptions="Center" VerticalOptions="Center">
<ImageButton
Grid.Row="0"
Grid.Column="0"
BackgroundColor="Transparent"
Clicked="ImageButton_OnClicked"
HeightRequest="35"
Source="favouritesdatatick[HOW TO CHANGE THIS]"
WidthRequest="35" />
Grid>
Grid>
Grid>
DataTemplate>
syncfusion:SfListView.StartSwipeTemplate>

How can I access my ImageButton (in say ListView_SwipeStarting) and then set the imageButton accordingly?

Or can I just bind the image value to the ViewModel associated with the ListView row?


Thanks

Matt


3 Replies 1 reply marked as answer

RM RiyasHameed MohamedAbdulKhader Syncfusion Team October 10, 2023 01:21 PM UTC

Hi Mathew,
We have reviewed your reported query and assume that you want to change the SwipeView image when tapping it. To achieve this, we recommend using a converter to change the image at runtime when tapping on the SwipeView. You can obtain the tapped item using the Command, and then change the image based on the property in the Model. We have prepared a simple sample for your reference and attached it below.

Regards,
Riyas Hameed M



Attachment: ListViewSwipe_5dcf4ee7.zip

Marked as answer

MA Matthew October 11, 2023 06:48 AM UTC

That is perfect thank you.



SP Sangavi Periyannan Syncfusion Team October 16, 2023 05:31 AM UTC

Matthew,


Glad that your issue is resolved!! Please let us know if you need further assistance. As always, we are happy to help you out. 


Loader.
Up arrow icon