I tried to return the same size in the OnMeasure method. If I set the RowDefinition value as auto for my custom control, the custom control renders in the next row definition space also.
The custom control renders in 3 and 4 rows and the 4th-row control not visible on the screen.
Sample: CustomControl sample
[Xaml]
<Grid ColumnDefinitions="*,0.3*" RowDefinitions="auto,200,auto,auto">
<Button BackgroundColor="Blue" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" ></Button>
<Button BackgroundColor="Green" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" ></Button>
<local:MyBoxView BackgroundColor="Red" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" />
<Button Text="Button" BackgroundColor="Brown" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" />
</Grid>
[C#]
public class MyBoxView : BoxView
{
public MyBoxView()
{
}
protected override SizeRequest OnMeasure(double widthConstraint, double heightConstraint)
{
return new SizeRequest(new Size(widthConstraint, heightConstraint));
}
}
When I add the custom(MyBoxview) control inside grid view means working properly. Please provide any suggestions on this.