If you want to do this for a specific instance of an Entry you want to create an inheritance and check for that in the above code. Place this anywhere you like somewhere in the startup of your app. If you want to do this for all Entry controls in your app, you can do this: .Mapper.AppendToMapping('CursorColor', (handler, view) => The official docs on how to do that can be found here. What you want to do is create a modify the mapper. That only exists for compatibility reasons with Xamarin.Forms.
While renderers (from the other answer) still work, you shouldn't be using it anymore.