Hi all,
I want to change the height of a button in a CustomRenderer. (The renderer does a bit more but this is also one feature of it)
I implemented that successfully for Android, however under iOS I just can't get it to work.
I have a class (lets call it MyButton) which inherits from Button in my Forms project:
`public class MyButton:Button
{
public static readonly BindableProperty ButtonHeightProperty =
BindableProperty.Create(nameof(buttonHeight), typeof(float), typeof(MyButton));
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
{
if (buttonHeight > 0)
heightConstraint = buttonHeight;
return base.OnMeasure(widthConstraint, heightConstraint);
}
}`
As you can see it takes a buttonHeight parameter from XAML and in the OnMeasure it replaces the heightConstraint with the value (if valid).
This works for Android, but not under iOS.
So I tried to do it in iOS directly from the CustomRenderer but no matter which solution I try, change the frame size, changing the bounds size, adjusting the height constraints, setting the button to a custom button via SetNative Control, no matter what, the button doesn't resize.
Does anyone have an idea how to solve that? Perhaps there is a solution for Android and iOS directly into the MyButton Forms class?
Thank you!