kayrk
Topic Author
Posts: 41
Joined: 07 May 2014, 19:41

TextBlock Foreground

14 May 2014, 18:56

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
 
User avatar
Scherub
Posts: 141
Joined: 06 May 2014, 20:53
Contact:

Re: TextBlock Foreground

15 May 2014, 00:27

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?
 
User avatar
jsantos
Site Admin
Posts: 4266
Joined: 20 Jan 2012, 17:18
Contact:

Re: TextBlock Foreground

15 May 2014, 19:04

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.
 
User avatar
sfernandez
Site Admin
Posts: 3222
Joined: 22 Dec 2011, 19:20

Re: TextBlock Foreground

16 May 2014, 11:13

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.
 
kayrk
Topic Author
Posts: 41
Joined: 07 May 2014, 19:41

Re: TextBlock Foreground

16 May 2014, 15:52

Thanks fernandez I think I will wait for the inlines.

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests