trying to bind swipeview to itemvalue in SFListView

I'm using the Listview with the swipe options. 

Now I wanted to have a dynamic mapping between the item and an Icon shown.

here is my template

                        <xForms:SfListView.RightSwipeTemplate>

                            <DataTemplate x:Name="RightSwipeTemplate">

                                <Grid>

                                    <Grid

                                        Grid.Column="0"

                                        BackgroundColor="#009EDA"

                                        HorizontalOptions="Fill"

                                        VerticalOptions="Fill">

                                        <Grid HorizontalOptions="Center" VerticalOptions="Center">

                                            <Image

                                                Grid.Row="0"

                                                Grid.Column="0"

                                                BackgroundColor="Transparent"

                                                BindingContextChanged="RightImage_BindingContextChanged"

                                                HeightRequest="35"

                                                WidthRequest="35">

                                                <Image.Source>

                                                    <FontImageSource

                                                        FontFamily="{DynamicResource BoxPlannerFonts}"

                                                        Glyph="{Binding Read, Converter={StaticResource BoolToImageConverter}, FallbackValue=true, TargetNullValue=true}"

                                                        Size="24" />

                                                </Image.Source>

                                            </Image>


                                        </Grid>

                                    </Grid>

                                </Grid>

                            </DataTemplate>

                        </xForms:SfListView.RightSwipeTemplate>


I'm trying to access the "Read" attribute of the item, so that I can have a different image presented when the status changes. 

Before I used the binding contextchanged, but this only works once.

If I want to switch between read and unread, then the swipe image is always the same.




1 Reply

LN Lakshmi Natarajan Syncfusion Team August 24, 2021 10:31 AM UTC

Hi Michael, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “trying to bind swipeview to itemvalue in SFListView” from our side. We would like to inform you that you can bind item data to the SwipeView by binding the Model properties. 
 
We have prepared a sample to change the image in the SwipeView at run time and attached the sample and video for the same, 
 
You can also refer to our user guidance document to work with swipe templates from the following link, 
 
Please let us know if you need further assistance. 
 
Lakshmi Natarajan 
 


Loader.
Up arrow icon