FlowDocument - different coloured text in a word
-
If I want to display the word "hello" in a flowdocument I would write:
hello
How do I get each letter of the word "hello" to be a different colour?
-
If I want to display the word "hello" in a flowdocument I would write:
hello
How do I get each letter of the word "hello" to be a different colour?
Each letter will be in its own Run and you would style them individually.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
-
Each letter will be in its own Run and you would style them individually.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
Thank's for your reply. Run adds a space so I get "H e l l o"
-
Thank's for your reply. Run adds a space so I get "H e l l o"
Use a
Span
tag for each character: <Span Foreground="Red">H</Span><Span Foreground="Orange">e</Span><Span Foreground="Yellow">l</Span><Span Foreground="Green">l</Span><Span Foreground="Blue">o</Span> -
Use a
Span
tag for each character: <Span Foreground="Red">H</Span><Span Foreground="Orange">e</Span><Span Foreground="Yellow">l</Span><Span Foreground="Green">l</Span><Span Foreground="Blue">o</Span>Span adds leading spaces too
-
Span adds leading spaces too
I tested it! :) ... (in WPF, not Silverlight) Of course, there can be no spaces between the Span tags (end of one Span and beginning of the next). Just as I showed in posting above...
-
I tested it! :) ... (in WPF, not Silverlight) Of course, there can be no spaces between the Span tags (end of one Span and beginning of the next). Just as I showed in posting above...
Ah - I just found that out too - it's the same with Run Thanks for your help :-D
-
Each letter will be in its own Run and you would style them individually.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier
You were right - but all the Run elements have to be on the same line. Thanks for your help<