TextBlock Foreground
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
ex. Kayrk: message here
Re: TextBlock Foreground
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
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.
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.
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: TextBlock Foreground
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:
For more complicated scenarios you should wait until we get text Inlines working.
Code: Select all
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding UserName}" Foreground="Red"/>
<TextBlock Text="{Binding UserMessage}" Foreground="Blue" Margin="4,0,0,0"/>
</StackPanel>
Re: TextBlock Foreground
Thanks fernandez I think I will wait for the inlines.
Who is online
Users browsing this forum: Ahrefs [Bot] and 3 guests