Reputation:
I want to make a clickable LinearLayout. I already set the Layout to Clickable and Focusable, but how can I write code in mainActivity.cs like:
LinearLayout.ItemClick += LinearLayout_ItemClick;
void LinearLayout_ItemClick(Object sender, AdapterView.ItemClickEventArgs e)
{
//Do something...
}
Because it says that a Layout doesn't have the clickable function!?
Upvotes: 1
Views: 744
Reputation: 579
Would it be layout.Click
instead of layout.ItemClick
?
ItemClick
is intended for lists, and allows you to define the behaviour when clicking on the elements of those lists
Update :
Your argument will not be AdapterView.ItemClickEventArgs
anymore, I have no pc right here but if you type .Click +=
, visual studio's intellisense should suggest you to add a handler and would create it for you with the right type :-)
Hope it solves your problem!
Upvotes: 2