Partially Coloured TextBlock

I stumbled upon an interesting question on StackOverflow where someone is using a series of TextBlocks in a StackPanel to show them side by side and would like part of the displayed text to be coloured with one colour and the rest with another.

There has got to be a thousand ways to do this, but it got me thinking of how I would do it, and especially, how to do it quickly because I have a job besides StackOverflow Smile with tongue out

Here’s my take on the problem. Lire la suite « Partially Coloured TextBlock »

Define « seamless »…

(Disclaimer: although I’m all for constructive criticism most of the time, this is clearly nothing more than a rant, which by the way, does not even deserve translating.)

Lets start with a dictionary definition of the word seamless:

adjective. perfectly consistent and coherent

Now lets take a look at a quote from the website of a product I decided to work with while writing my book on WPF (highlight mine):

Expression Design is the perfect companion to Expression Blend, letting you quickly build sophisticated vector assets. Then seamlessly transfer — by way of XAML — your graphics to your Expression Blend projects.

Finally, lets take a look at what actually happens when the product in question « seamlessly » exports to XAML:


Do you see it too? How its not at all consistent or coherent, but rather the outlines become horrible thick black blotches and the gradients simply disappear? Ah, thank you… That’s a relief. For a moment there I thought it was just me.

In whoever wrote that clearly fallacious marketing crap’s defense, they do seem to know what the imputed word means. Take a look at this other quote:

Or seamlessly copy and paste your images into Microsoft Office while preserving transparency.

Ah, now this one does work, as you can see in this screen-shot:


You have to wonder what kind of black magic is behind this magnificent feat:


Oh, a PNG. Why not?