我有一個名為 SidebarItems 的物件串列,此串列可能會根據用戶所在的模塊而變化。我已經下載并讓 Font Awesome Pro 在我的應用程式中作業,但是我必須使用 Unacode 訪問字體內的正確圖示。
SidebarNavItem
public record SidebarNavItem(string Title, string ViewName, string IconUnicode);
public class SidebarItems:IReadOnlyCollection<SidebarNavItem>
{
//Left this out for brevity
}
正在使用的 Xaml
<Button Style="{StaticResource LabeledIconButton}"
Content="{Binding IconUnicode}" Grid.Row="0"
behaviors:ButtonBehavior.Label="{Binding Title}"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding ViewName}"/>

這就是我得到的,但是當我在按鈕中輸入它時,我得到了這個:
<Button Style="{StaticResource LabeledIconButton}"
Content="" Grid.Row="0"
behaviors:ButtonBehavior.Label="{Binding Title}"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding ViewName}"/>

我怎樣才能將這些代碼存盤在SidebarItems?
uj5u.com熱心網友回復:
替換&#x為并洗掉從屬性回傳的值\u的尾隨。;string
于是變成:
public string IconUnicode => "\uf319";
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/504346.html
