1

My use case is to display emoji in a ListView in UWP applicataion. For that purpose I created a class with 2 properties as below

    public string name { get; set; }
    public String emoji{ get; set; }

and binding the observablecollection of this class with the listview Template

 <DataTemplate x:Key="IconTextTemplate" x:DataType="models:Project">
        <RelativePanel >
            <TextBlock x:Name="emoji" Text="{x:Bind emoji}" />
            <StackPanel>
                <TextBlock Text="{x:Bind name}" " />
            </StackPanel>
        </RelativePanel>
    </DataTemplate>

The value of emoji I have set is '\u1F610' but upon running the application system converts the value of emoji which is (UTF32) to UTF16 and prints last character as is so I am loosing out the representation of emoji. I have done bit googling around it and I got to know that string in .net are by default UTF16 encoded, hence I cannot create UTF32 encoded string.

Can anyone help me find alternative for this.

Output looks like this:

output

JD-V
  • 3,336
  • 1
  • 17
  • 20
  • Can you show the output? Also not sure why you are showing WPF here, doesn't seem relevant at all. I would be more interested how you get or set the data. – Patrick Hofman Mar 15 '18 at 12:46
  • 3
    Possible duplicate of [How to convert emoticons to its UTF-32/escaped unicode?](https://stackoverflow.com/questions/44728740/how-to-convert-emoticons-to-its-utf-32-escaped-unicode) – Stephan Bauer Mar 15 '18 at 12:53
  • Thank you @StephanBauer It helped. :) – JD-V Mar 15 '18 at 12:59

0 Answers0