AlinaEVE
Topic Author
Posts: 5
Joined: 06 Jul 2023, 08:49

About how to add images or binding in rich text in the UE environment.

14 Sep 2023, 10:30

Hello!
I have read the tutorial on RichText and the localization example in UE. I found that I couldn't use BBCode in UE, and I'm not sure what standard is used for rich text in UE. Also, I'm not sure how to add images or binding in RichText in UE. Here is the method I tried.
		<TextBlock >
			<Run>test</Run>
			<InlineUIContainer>
				<Image Source="Resources/Images/Icon/test/gamepad_a.png" Stretch="None"/>
			</InlineUIContainer>
			<Run>Test</Run>
		</TextBlock>
		<!--it worked,But from a development perspective, this approach cannot be used.-->
		
		<TextBlock noesis:RichText.Text="{noesis:LocTable 'test',Key=DescLabel}" Margin="0,150"/>
		<!--it worked-->
		
		<TextBlock noesis:RichText.Text="{Binding TestImage}" Margin="0,250"/>
		<!--it didn't worked-->
		
		<Label Content="{noesis:LocTable 'test1' ,Key=DescLabel}" Margin="0,350" />
		<!--it didn't worked,so i can't use Label in UE?-->
		
		<TextBlock noesis:RichText.Text="There are [i]many[/i] ways to implement localization in [style=ColoredText]NoesisGUI[/style]."  Margin="0,450"/>
		<!--it didn't worked-->
		
		<TextBlock noesis:RichText.Text="{Binding TestText}" Margin="0,550"/>
		<!--it worked-->
		
		<TextBlock noesis:RichText.Text="[Image]/Resources/Images/Icon/test/gamepad_a.png[/Image]"  Margin="0,650"/>
		<!--it didn't worked,it just prints out the path.-->
		
		<TextBlock noesis:RichText.Text="{Binding TestBinding}" Margin="0,750"/>
		<!--it didn't worked,it just prints out the path.-->
TestText = "There are <ItalicText>many</> ways to implement localization in <ColoredText>Noesis</>. In this example we are using our <ColoredItalicText>LocTable</> markup extension to integrate with Unreal localization system where we defined localized texts for each label. Each time the language is changed, the displayed text is updated accordingly. The <ColoredItalicText>RichText</> attached property for <ItalicText>TextBlocks</> allows you to use Unreal styles and images in your text.";
TestImage = "<img>/Resources/Images/Icon/test/gamepad_a.png</>";
TestBinding = "<bind>TestBinding_</>";
TestBinding_ = "test";
 
User avatar
jsantos
Site Admin
Posts: 3938
Joined: 20 Jan 2012, 17:18
Contact:

Re: About how to add images or binding in rich text in the UE environment.

15 Sep 2023, 20:04

In Unreal, RichText is using Unreal-style markup syntax as described here.

I have improved the documentation of RichText to mention this divergence

Who is online

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