Cropping a Canvas Before Returning From OnDraw

Nathan Sokalski 4,111 Reputation points
2022-04-28T19:43:48.99+00:00

I have a custom View in which I override the OnDraw method. Before returning the Canvas, I want to crop it, but I cannot find a way to do this. SetViewport does not work, and none of the .Clip* methods seem to do anything. How can I control what part of the Canvas is actually used?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,366 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.