Hello,
I reproduced your problem with the following Drawable, and the reason for this problem is that in ContentView, if you don't set the minimum width and height, in Windows its size is 0.
public class GraphicsDrawable : IDrawable
{
public void Draw(ICanvas canvas, RectF dirtyRect)
{
LinearGradientPaint linearGradientPaint = new LinearGradientPaint
{
StartColor = Colors.Yellow,
EndColor = Colors.Green,
// StartPoint is already (0,0)
EndPoint = new Point(1, 0)
};
RectF linearRectangle = new RectF(10, 10, 200, 100);
canvas.SetFillPaint(linearGradientPaint, linearRectangle);
canvas.SetShadow(new SizeF(10, 10), 10, Colors.Grey);
canvas.FillRoundedRectangle(linearRectangle, 12);
}
}
Therefore, you could set MinimumHeightRequest and MinimumWidthRequest to GraphicsView to solve this problem.
<GraphicsView MinimumHeightRequest="300" MinimumWidthRequest="300" x:Name="gViewPart" HorizontalOptions="Center" Drawable="{StaticResource drawable}"/>
Best Regards,
Alec Liu.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.