I am trying to implement context actions in my viewcells. I'd like to add two different menu actions based on a property of the object binded in the view cells. I have a listview of objects, when i select one of them, I would like to show one menu item or the other. But I don't know how to get this.
I thought to use protected override void OnBindingContextChanged () and get the object in this way:
protected override void OnBindingContextChanged ()
{
base.OnBindingContextChanged ();
myObject = (MyObject)BindingContext;
if(myObject.myproperty)
ContextActions.add(action1);
else
ContextActions.add(action2);
}
is this the right way?