Pixel shaders

This documentation only applies to WPF

Catel also uses pixel shaders to apply effects to controls via themes and styles. One of the pixel shaders is, for example, the GrayscaleEffect. This effect automatically converts an image on a button to gray scale when the button is disabled. Below is an example of the shader effect:

If there are a lot of buttons used on the screen, it might be possible that the video card does not support so many shaders, and then WPF will start throwing exceptions. In that case, first try to set the shader mode of Catel to ShaderRenderMode.Software. If that doesn’t work, you can turn the shaders off by using ShaderRenderMode.Off.

// Force software rendering
StyleHelper.PixelShaderMode = PixelShaderMode.Software;

// Turn off
StyleHelper.PixelShaderMode = PixelShaderMode.Off;