This works for me in 1.9.2, but I have to long-press the button to view the
context menu.
So this is either a bug fixed in 1.9.x, or you're not long-pressing the button.
Just clicking the button will trigger the Button.Click event, and not show the
context menu; you need to long-press to get the context menu.
Thanks,
- Jon
On Oct 27, 2011, at 3:24 PM, bauermt40 wrote:
> I am trying to implement a ContextMenu from a button, but it doesn't appear
> to be working. I register the button, but when I click the button, nothing
> is happening. Any ideas? Also, I'm using MonoDroid 1.2. Thanks.
>
> public class MainActivity : Activity
> {
> protected override void OnCreate(Bundle bundle)
> {
> base.OnCreate(bundle);
>
> SetContentView(Resource.Layout.main);
>
> Button btnMenu =
> (Button)FindViewById(Resource.Id.btn_menu_options);
> RegisterForContextMenu(btnMenu);
> }
>
> public override void OnCreateContextMenu(IContextMenu menu, View v,
> IContextMenuContextMenuInfo menuInfo)
> {
> base.OnCreateContextMenu(menu, v, menuInfo);
>
> menu.SetHeaderTitle(Resource.String.menu_title);
> menu.Add(Resource.String.menu_option1);
> }
> }
>
> --
> View this message in context:
> http://mono-for-android.1047100.n5.nabble.com/RegisterForContextMenu-doesn-t-appear-to-be-working-tp4943954p4943954.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid