0
votes

so I have xamarin.forms 4.5.0.725 in my project, I have a content page, with a listview like this

<RefreshView Refreshing="Refresh_Refreshing" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <ListView x:Name="alertsList" SelectionMode="None" SeparatorColor="DimGray" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <Grid Padding="5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Image Grid.Column="0" WidthRequest="24" Aspect="AspectFit" Source="someicon"/>
                        <Label Grid.Column="1" Text="{Binding Path=Message, Mode=OneWay}" FontSize="Small" VerticalTextAlignment="Center" />
                        <Button Grid.Column="2" Text="Fix" BindingContext="{Binding}" Clicked="Fix_Clicked" FontSize="Small" HeightRequest="35" WidthRequest="50" VerticalOptions="Center"/>
                    </Grid>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</RefreshView>

and the button clicked handle

void Fix_Clicked(object sender, EventArgs e)
{
    DisplayAlert("alert", "button clicked", "ok");
}

everything works fine until I update xamarin.form to 4.6 or above, I tried 4.6.0.1180 4.7.0.1351 4.8.0.1364 the button in listview row does not fire click event anymore, I also tried Command and CommandParameter instead of Clicked

anyway to fix this or workaround ?

EDIT: created a sample project from google drive

run it, click was fine; "manage nuget packages for solution", update XF to 4.6.0.1180 or above, run it again, click does not work.

2
I could not reproduce this issue in the above XF version you mentioned.Did you try to delete the obj and bin files ,restart the project.If it still cold not work,try to create a new project.Leo Zhu - MSFT
yes I did, I also delete the app from android simulator and reinstall @LeoZhu-MSFT , 4.5.0.725 works fine, 4.6.0.1180 or above does not fire click eventLeowan
If possible,you could share a sample project,i will test it.Leo Zhu - MSFT
thank you for your time, please check the project @LeoZhu-MSFTLeowan
Could it work now ?Leo Zhu - MSFT

2 Answers

0
votes

It's weird,i test it and it works well.

update the XF versin to 4.6.0.1180

enter image description here

the effect i run it:

enter image description here

i'm using

Microsoft Visual Studio Enterprise 2019

Version 16.5.4

Xamarin.Fomrs 4.6.0.1180

0
votes

I don't know how or why, but it just works if I remove the outer RefreshView. it works on Xamarin.Fomrs 4.5.0.725, 4.6.0.1180, 4.7.0.1351 and 4.8.0.1560

and tried something more:

keep the RefreshView, but remove Padding="5,0,5,5"(sample project has) from it, it also work.

unbelievable...