0
A
回答
1
如果使用XAML
,你可以在App.xaml
聲明所有UI的東西(Color
S,Style
小號等):
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Sample.App">
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Black">#000000</Color>
<OnPlatform x:TypeArguments="x:String" x:Key="FontFamilyMedium">
<OnPlatform.iOS>Roboto-Medium</OnPlatform.iOS>
<OnPlatform.Android>sans-serif-medium</OnPlatform.Android>
<OnPlatform.WinPhone></OnPlatform.WinPhone>
</OnPlatform>
</ResourceDictionary>
<Style x:Key="LabelStyle" TargetType="Label">
<Setter Property="FontFamily" Value="{StaticResource FontFamilyMedium}" />
</Style>
</Application.Resources>
</Application>
然後從任何頁面中使用它們:
<Frame BackgroundColor="{StaticResource Black}" />
<Label Style="{StaticResource LabelStyle}" />
不要忘記添加到App.xaml.cs
:
public App()
{
InitializeComponent();
}
相關問題
- 1. Facebook應用程序:圖形API /集成點與FB配置文件
- 2. Facebook頁面上的隱形應用程序配置文件
- 3. android應用程序配置文件
- 4. AngularJS應用程序配置文件
- 5. 應用程序配置文件
- 6. iPhone應用程序配置文件
- 7. GWT應用程序配置文件
- 8. 應用程序配置文件
- 9. Xamarin iOS應用程序配置文件
- 10. web2py應用程序配置文件
- 11. Flask應用程序的配置文件
- 12. 應用程序配置文件清理
- 13. 應用程序文件缺失配置
- 14. iOS應用程序配置文件
- 15. MIX應用程序的配置文件爲OTP應用程序
- 16. 爲ADFS配置生成應用程序元數據文件
- 17. 爲多個應用程序配置一個配置文件
- 18. 供應配置文件和應用程序名稱不匹配
- 19. 供應配置文件中的應用程序ID用於iPhone應用程序
- 20. 從程序集中查找應用程序配置文件
- 21. 適用於Windows的應用程序配置文件通用應用程序
- 22. 漫遊配置文件的應用程序/用戶設置
- 23. Windows進程激活服務無法生成應用程序池配置文件
- 24. 配置文件不匹配應用程序標識符com.domainname.helloworld
- 25. 用戶配置文件與色器件,清單應用程序
- 26. 沒有這樣的文件加載 - /應用程序/配置/應用程序
- 27. 連接應用程序配置文件頁面與應用程序
- 28. 在應用程序商店提交應用程序和開發配置文件
- 29. C# - 應用程序配置文件 - 自定義設置
- 30. springboot應用程序:如何設置配置文件propery與spel?
您可以創建靜態類並將所有項目設置爲常量或只讀屬性。 –
System.Configuration的時間已結束。 –