I'm quite new to C# and Xamarin and have been trying to implement a bottom sheet element and don't know how to correctly do it. I am using Cocosw.BottomSheet-Xamarin.Android library.
Here is my code:
Cocosw.BottomSheetActions.BottomSheet.Builder b = new Cocosw.BottomSheetActions.BottomSheet.Builder (this);
b.Title ("New");
b.Sheet (Resource.Layout.menu_bottom_sheet)
Now i think i should use b.Listener(...)
, but it requires an interface IDialogInterfaceOnClickListener
as a paramater and i don't know how to do it in C# correctly.
In Java i could write
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
}
});
I tried doing this:
class BottomSheetActions : IDialogInterfaceOnClickListener {
public void OnClick (IDialogInterface dialog, int which) {
Console.WriteLine ("Hello fox");
}
public IntPtr Handle { get; }
public void Dispose() {
}
}
and then this:
b.Listener (new BottomSheetActions());
But it didnt work.
Use click event instead.
button.Click += delegate
{
//Your code
};
See my other answer for more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With