markolazic88 / SwipeCardView

MIT License
173 stars 38 forks source link

Add Button on Card #4

Closed naumanahmed19 closed 5 years ago

naumanahmed19 commented 6 years ago

Thanks for awesome plugin.

Is this possible to add button or any other element on card? I have added button but its not clickable.

markolazic88 commented 6 years ago

Hey Nomi, I am glad you like it! I just tried your use case and button clicks are not fired indeed. The reason is that the library sets CardView's InputTransparent property to True, which prevents any input field to get touch event. I tried removing setting InputTransparent = true, and I was able to get button click event in code behind. For some reason, MVVM binding didn't work.

Once I find time I will do additional tests and if no side effects, I will remove InputTransparent = true. In the meantime you could download source code of the library, do the same removal, and see if it works for you.

markolazic88 commented 5 years ago

InputTransparent = true is removed in SwipeCardView 2.0. This means that you will be able to add button to the card and receive a click event from that button. But keep in mind that Xamarin.Forms does not support propagation of touch events. If you add button to your ItemTemplate, that button will be receiving click events regularly, but you will not be able to initiate the dragging movement from within the button area.