JP29
JP29

Reputation: 625

C# Monodroid Event Handlers

How do I operate the event handlers in C# Monodroid using:

m_listView.OnTouchEvent += OnTouchEvent;

It doesn't work as it would for a button or an item, and it gives an error:

"Cannot Assign to OnTouchEvent because it is a method group".

Upvotes: 1

Views: 299

Answers (2)

SKall
SKall

Reputation: 5234

Like choper said that method is one you would override on a custom view. To subscribe to the touch event you should use Touch instead:

        m_listView.Touch += HandleTouch;
    }

    void HandleTouch (object sender, View.TouchEventArgs e)
    {
        // e.Event => MotionEvent
    }

Upvotes: 1

choper
choper

Reputation: 1292

It's not event at all, it just a method so the code that you provided should not work at all. You can override this method if you create custom ListView but you can not subscribe on it as on an event

Upvotes: 0

Related Questions