【发布时间】:2019-04-04 07:34:59
【问题描述】:
我正在寻找一种解决方案来自定义带有圆角的点按式列表视图单元格灰色
这就是我现在所拥有的但我需要将灰色设置为下一张图片
**这就是我所期待的!!!
<ListView ItemSelected="ItemSelected" ItemsSource="{Binding Patients}" SeparatorVisibility="None">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<custom:RoundedCornerView RoundedCornerRadius="12" Margin="11,5.5,11,5.5" VerticalOptions="FillAndExpand" >
<StackLayout Orientation="Vertical" BackgroundColor="White" Padding="11" >
<Label Text="{Binding WardName}".../>
</StackLayout>
</custom:RoundedCornerView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
【问题讨论】:
-
好吧,我有一个问题,你到底想做什么我的意思是你想要当你点击你的列表视图时,选定的项目颜色变化应该有圆形边框?我的意思是我不明白
-
@G.hakim 是的,只有 custom:RoundedCornerView 视图应该突出显示(而不是列表视图的整个视图单元格)
-
所以你将不得不对一些事情进行更改,我会在某个时候更新答案
-
您需要一个 ViewCell 自定义渲染器来删除默认选择颜色或将其更改为您想要的任何颜色。之后,添加一个 TapGestureRecognizer 并更改框视图 onclick 的背景颜色
-
@DuminduDeSilva - 在这里查看我的答案,它可能会帮助你stackoverflow.com/questions/25885238/…
标签: xaml xamarin xamarin.forms