WinRT doesn't have OuterGlowBitmapEffect
. So, is there any way to display the outer glow effect for a TextBlock
in WinRT?

- 6,409
- 16
- 72
- 140
-
What type of content do you want to apply a glow to? Is it text, vectors or bitmaps and does is it static or not? – Kris Oct 20 '12 at 18:26
-
If you don't want to use HTML and CSS I would go with 2nd option I posted unless you need to support many fonts and sizes or paragraphs of text. It would need a few tweaks for WinRT. – Kris Oct 20 '12 at 19:02
1 Answers
There is not a good way to apply effects to XAML content, WinRT also currently lacks a way to render XAML elements to a bitmap so you are mainly left with methods where you don't use XAML.
Make sure the glow is necessary and you have reviewed the guidelines for Windows 8 apps. If your sure you need it here are a few suggestions:
For simple cases you may be able to use gradients or duplicated geometry to get a glow affect.
Bundle graphics with the glow already applied with your app, this obviously wouldn't work for completely dynamic shapes but you could do it for text similar to my answer here.
Use Direct2D instead of XAML and use Direct2D effects (SharpDX offers bindings for Direct2D)
If you need to apply a glow to a bitmap you could use a WriteableBitmap and apply the glow yourself. (WriteableBitmapEX could be useful)
Use HTML and CSS instead of XAML, possibly hosted in a WebView or for the whole app.
-
I have to display text on a image which has both light and dark background so I really need to use the outer glow effect. – Elmo Oct 21 '12 at 16:02
-
Putting a black textblock under a white one and shifting it diagonally would make the text visible but if you do need a glow the 2nd and 3rd options would work. I can look at updating the code for WinRT if needed. This is much simpler in HTML as text-shadow is supported. – Kris Oct 21 '12 at 16:35