I'd like to implement my own control for Windows Phone. The catch is, that I want to draw it myself - in regular WPF I'd simply override OnRender
method and provide my own implementation. However, there is no OnRender
method available on Windows Phone. What other options do I have?
What is not acceptable in my case is:
Since Windows.UI.Xaml doesn't have a raster graphics API the only options are to use vector graphics, to render into a bitmap and display that, or to interop to DirectX.
Microsoft's Win2D library at http://microsoft.github.io/Win2D (also see http://blogs.msdn.com/b/win2d/ ) exposes Direct2D through C# and is probably the best match for what you are looking for. It is a work in progress and provides most basic features, but if you need more you'll need to do the interop yourself.
The closest other option is to use a 3rd party library such as WriteableBitmapEx for a high level API to draw into a WriteableBitmap. You could extract the generated bitmap into an ImageBrush for display without an explicit Image control.