<DataTemplate x:Key="searchlistAn">
<SwipeView Padding="0,0,10,0">
<SwipeView.RightItems>
<SwipeItem Text="2333" BackgroundColor="Red"></SwipeItem>
</SwipeView.RightItems>
<SwipeView.Content>
<Frame Padding="10">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="ClickGestureRecognizer_Clicked"/>
</Frame.GestureRecognizers>
<Grid Padding="0" ColumnDefinitions="auto,auto,2*,*,*" ColumnSpacing="10">
<Border Grid.Column="0" BackgroundColor="#0066FF" HeightRequest="5" WidthRequest="5" StrokeThickness="0">
<Border.StrokeShape>
<RoundRectangle CornerRadius="5"></RoundRectangle>
</Border.StrokeShape>
</Border>
<Border Padding="0" HeightRequest="50" WidthRequest="50" Grid.Column="1" StrokeThickness="0">
<Border.StrokeShape>
<RoundRectangle CornerRadius="10"/>
</Border.StrokeShape>
<Grid WidthRequest="50" HeightRequest="50">
<Image Aspect="Fill" Source="defimage.webp" WidthRequest="50" HeightRequest="50"></Image>
<Image Aspect="Fill" WidthRequest="50" HeightRequest="50">
<Image.Source>
<UriImageSource Uri="{Binding ImageUrl}" CacheValidity="5"/>
</Image.Source>
</Image>
</Grid>
</Border>
<Label VerticalOptions="Center" Text="{Binding songname}" Grid.Column="2"></Label>
<Label VerticalOptions="Center" Text="{Binding singer}" Grid.Column="3"></Label>
<Label VerticalOptions="Center" Text="{Binding abname}" Grid.Column="4"></Label>
</Grid>
</Frame>
</SwipeView.Content>
</SwipeView>
</DataTemplate>
<CollectionView x:Name="mycoll" Grid.Row="3" Grid.Column="0" ItemsSource="{DynamicResource mkarr}" ItemTemplate="{StaticResource searchlistAn}" SelectionMode="None" Scrolled="mycoll_Scrolled">
Resources["mkarr"] = await QQmusic.search(searchBar.Text.Replace(" ", ""));
public static async Task<List<songbase>> search(string keyword)
{
return new List<songbase>();
}
public class songbase
{
public string songname { get; set; }
public string singer { get; set; }
public string abname { get; set; }
public string ImageUrl { get; set; }
public string mid { get; set; }
public string id { get; set; }
}
这个list的数据:
songbase,songbase.songname,songbase.singer,songbase.abname,songbase.ImageUrl,songbase.mid,songbase.id
jngMUSIC_MAUITEST.songbase,坏女孩,徐良/小凌,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000002apRhZ4Bq99d.jpg,0001oIjs0YFIf7,""
jngMUSIC_MAUITEST.songbase,犯贱,徐良/阿悄,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000003e3ohO0HKzIL.jpg,001QOU9Y4T1cmZ,""
jngMUSIC_MAUITEST.songbase,客官不可以,徐良/小凌,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000003e3ohO0HKzIL.jpg,004WtRjE21f2dN,""
jngMUSIC_MAUITEST.songbase,七秒钟的记忆,徐良/孙羽幽,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M0000029sRLP45DyKu.jpg,003o0Acd4PWz2j,""
jngMUSIC_MAUITEST.songbase,后会无期,汪苏泷/徐良,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000002apRhZ4Bq99d.jpg,004gZy7l1GYJ1Q,""
jngMUSIC_MAUITEST.songbase,红装,徐良/阿悄,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000003e3ohO0HKzIL.jpg,000fHxUW1i2uG8,""
jngMUSIC_MAUITEST.songbase,那时雨,徐良,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000002JsVIJ31j7qR.jpg,0013aGOv4ZNeXI,""
jngMUSIC_MAUITEST.songbase,他的猫,徐良/杨曦,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M0000029sRLP45DyKu.jpg,002O44py1SBulq,""
jngMUSIC_MAUITEST.songbase,飞机场,徐良/小凌,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000000wcMxg3sNfzp.jpg,000zndnl2NpgQk,""
jngMUSIC_MAUITEST.songbase,和平分手,徐良/Britneylee小暖,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000003e3ohO0HKzIL.jpg,00308aAJ45za7I,""
jngMUSIC_MAUITEST.songbase,情话,徐良/孙羽幽,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M0000029sRLP45DyKu.jpg,004Vp4x21F5jX3,""
jngMUSIC_MAUITEST.songbase,电话里的秘密,徐良,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000002apRhZ4Bq99d.jpg,003YY2C00B7ajE,""
jngMUSIC_MAUITEST.songbase,无颜女,徐良/小凌,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M0000045N6AZ0WhO0s.jpg,002A39va2jsOXd,""
jngMUSIC_MAUITEST.songbase,后会无期,徐良/汪苏泷,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000002z54BF0JsMyR.jpg,003HLZCt3McOHO,""
jngMUSIC_MAUITEST.songbase,抽离,徐良/刘丹萌,QQ音乐,https://y.gtimg.cn/music/photo_new/T002R300x300M000001GraMO3JQQLr.jpg,0018BYrF3ANbLX,""
调试跳转:

非常感谢您的任何回答。