Reputation: 193
I'm using xaml universal project and have problem displaying some characters of font Segoe MDL2 Assets after converting to string in code behind. Please see images and anyone with ideia how to fix this:
Xaml:
<converters:MyTypeConv x:Key="myTypeConv" />
<dSrc:clsLstElem x:Key="lstCmdAnsw">
<dSrc:clsElem iAuto="0" />
<dSrc:clsElem iAuto="1" />
<dSrc:clsElem iAuto="2" />
</dSrc:clsLstElem>
Xaml usage:
<Border CornerRadius="5" BorderBrush="Black" BorderThickness="1">
<ItemsControl ItemsSource="{StaticResource lstCmdAnsw}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button
Content="{Binding iAuto, Mode=OneWay, Converter={StaticResource myTypeConv}}"
FontFamily="Segoe MDL2 Assets"
FontSize="{ThemeResource ContentControlFontSize}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Border>
Code behind:
public class MyTypeConv : Windows.UI.Xaml.Data.IValueConverter
{
public object Convert(object value, Type targetType,
object parameter, string language)
{
string s = string.Empty;
if (value != null)
{
switch ((int)value)
{
case 0:
s = "\uE81D";
break;
case 1:
s = "\uE927;";
break;
case 2:
s = "\uE916;;";
break;
}
}
return s;
}
}
Upvotes: 3
Views: 2249
Reputation: 128070
Remove the trailing semicolons, i.e. replace
s = "\uE927;";
s = "\uE916;;";
by
s = "\uE927";
s = "\uE916";
Upvotes: 4