I'm trying to implement a solution to increase the size of a ListView
Cell
when tapped using Xamarin Forms
(and custom renderers if required).
I'm still pretty new to C#, and the idea of data binding is still a little unclear to me, however, it seems like that is the way to go to solve this problem (perhaps something along the lines of binding the Height
/ HeightRequest
properties of the cell?).
My attempts thus far have been unsuccessful.
If anyone could give me a push in the right direction it would be much appreciated.
Thank you!
ViewCell
does not exposeHeight
as aBindableProperty
inXamarin.Forms 1.4.2x
However if you create your own
BindableProperty
in yourModel
you can achieve changing the height still as shown below:-Model:-
XAML:-
XAML Code-Behind:-
If you don't set
.HasUnevenRows
you will not be able to change the cell height.Custom ViewCell:-
Remember to call
ForceLayout
on the root element of theViewCell
'sView
property, so it can redraw correctly.This will give you a result something similar to the following (tested only on WindowsPhone at present):-
In order to do it on a
ViewCell
being tapped, on the XAML Page add:-and then change the
model
for the item to something like this:-