I have a list of objects called SidebarItems, this list may change according to what Module the user is in. I have downloaded and got Font Awesome Pro working in my application, However I must use the Unacode to access the correct icon inside the font.
The SidebarNavItem
public record SidebarNavItem(string Title, string ViewName, string IconUnicode);
public class SidebarItems:IReadOnlyCollection<SidebarNavItem>
{
//Left this out for brevity
}
The Xaml That its being used
<Button Style="{StaticResource LabeledIconButton}"
Content="{Binding IconUnicode}" Grid.Row="0"
behaviors:ButtonBehavior.Label="{Binding Title}"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding ViewName}"/>
This is what I'm getting but when I type it into the button, I get this:
<Button Style="{StaticResource LabeledIconButton}"
Content="" Grid.Row="0"
behaviors:ButtonBehavior.Label="{Binding Title}"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding ViewName}"/>
How can I store these codes in SidebarItems
?
CodePudding user response:
Replace &#x
with \u
and remove the trailing ;
from the string
value returned from the property.
So 
becomes:
public string IconUnicode => "\uf319";