Page 1 of 1

TextBlock Foreground

Posted: 14 May 2014, 18:56
by kayrk
Is it possible to color different parts of a textblock different colors? I know in WPF you could add different Runs to the textblock with TextBlock.Inlines.Add(new Run("text") { ForeGround = Color }); is anything like this possible in Noesis? Basically what I'm trying to do is make a chat control and make the players name a different color then the message they are sending. Any help is appreciated thanks.

ex. Kayrk: message here

Re: TextBlock Foreground

Posted: 15 May 2014, 00:27
by Scherub
According to this thread it's on their roadmap for version 1.2.1. What I would like to know is whether they will also support icons/symbols?

Re: TextBlock Foreground

Posted: 15 May 2014, 19:04
by jsantos
As said in another thread, if you insert the symbols directly in the TTF then the support is straightforward. Problem is that they can only be only single color fonts.

FreeType 2.5 (the library we use for text rendering) added support for color embedded bitmaps (eg. color emoji). We could integrate that support in noesisGUI in the future.

Re: TextBlock Foreground

Posted: 16 May 2014, 11:13
by sfernandez
If your text structure is simple you can always use some Panels and several TextBlocks to accomplish what you explained. For example, if you just want a red name and a blue message text, you can have:
<StackPanel Orientation="Horizontal">
    <TextBlock Text="{Binding UserName}" Foreground="Red"/>
    <TextBlock Text="{Binding UserMessage}" Foreground="Blue" Margin="4,0,0,0"/>
</StackPanel>
For more complicated scenarios you should wait until we get text Inlines working.

Re: TextBlock Foreground

Posted: 16 May 2014, 15:52
by kayrk
Thanks fernandez I think I will wait for the inlines.