What would be a simple way of drawing a radial gradient background (also being able to change it’s color) in a XAML/C# Metro-Style App ?
Is using DirectX an option ? I tried looking at some SharpDX samples for Windows 8 Consumer Preview but failed to compile them. Haven’t found any other samples of using DX in C# on Windows 8.
Any ideas ?
What would be a simple way of drawing a radial gradient background (also being
Share
RadialGradientBrush has not been added to the XAML stack yet. You can use WriteableBitmapEx to draw the gradient to a WriteableBitmap yourself and then use an Image or ImageBrush to display it – although that could be prohibitively slow if you have many elements that you want to use differently shaped gradients on.
You could just use a regular image created in Photoshop or Paint.NET.
Using DirectX might be too complicated and not really necessary, but you can mix DirectX with XAML. If you really want to go there – you would probably need to use SurfaceImageSource. There is a basic introduction on MSDN here or check a SharpDX sample here. You would probably also want to use Direct2D to render to that surface, so there are quite a few technologies you would need to mix.