I would like to modify the contents of a cell, triggered by an event tied to a cell.
I have a cell, CustomViewCell based on ViewCell. I have tried to override the OnLongPress method but does not seem to get hit.
I have setup a renderer for this, CustomViewCellRenderer in the android project:
public class CustomViewCellRenderer: ViewCellRenderer
{
public CustomViewCellRenderer() {
}
protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
{
var view =base.GetCellCore(item, convertView, parent, context);
view.LongClick +=
(object sender, Android.Views.View.LongClickEventArgs e)=>{
var cntx = this.Cell.BindingContext;
//cntx is now contains all ofthe data specific to that cell
//modify the cell content based on cntx
};
return view;
}
This appears to work well, so far, so in the debugger, a breakpoint on var cntx = this.Cell.BindingContext;
does get hit and cntx is the data that I want. How can I change the contents of the cell at that point (inside the event handler)? For example, how can I add a tick image to indicate that the data in the BindingContext for that cell was processed?
Cheers!