How to get Nearest Neighbor Interpolation working in Silverlight or WP7

If you landed here, you probably have found yourself using some pixel graphics in Silverlight or Windows Phone 7 (WP7) and realized that there is no Nearest Neighbor Interpolation available.

That sucks.

But here is a "solution". It's in no way perfect, and works only if you bind to a string pointing to your file, which should be local. But this could be easily fixed or worked around if you need to.

So, without further ado, here is the code:

And of course the obligatory screenshot:

Tagged WP7
Meta