Tried this one but did not work .
private void ViewCell_Tapped(object sender, EventArgs e)
{
var viewcell = (ViewCell)sender;
if (viewcell != null) {
viewcell.View.BackgroundColor = Color.Blue;
}
Moreover if you want to change the color on forms dynamically instead of hard code. Try to define a bindable property in your custom view cell class. Then configure it on each platform.
I am trying your demo using XF 3.6 (o am constricted to that version due to another pieces of software!), for iOS it does not work at all. Is there any way i can achieve that same result for XF 3.6?
Answers
Please go through this
https://developer.xamarin.com/guides/xamarin-forms/user-interface/listview/customizing-cell-appearance/
https://developer.xamarin.com/samples/xamarin-forms/WorkingWithListview/
Try the below code
[assembly: ExportRenderer(typeof(ViewCell), typeof(ViewCellTransparent))]
namespace MyApp.iOS.Renderers
{
public class ViewCellTransparent : ViewCellRenderer
{
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
if (cell != null)
{
// Disable native cell selection color style - set as Transparent
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
}
return cell;
}
}
}
We could use custom renderer to change that property on each platform. Firstly, create your own view cell class:
For iOS
For Android
Moreover if you want to change the color on forms dynamically instead of hard code. Try to define a bindable property in your custom view cell class. Then configure it on each platform.
Attachment is a whole sample you can refer to.
@jezh
Thanks for your answer.
I am trying your demo using XF 3.6 (o am constricted to that version due to another pieces of software!), for iOS it does not work at all. Is there any way i can achieve that same result for XF 3.6?