我想在app.xaml上設置我的資源,然後在應用程序的不同視圖中使用它,但是當我設置顏色時,應用程序會崩潰u.u,有人可以幫助我嗎?如何從全球資源中獲取用戶顏色?
的App.xaml
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary">#FFC107</Color>
</ResourceDictionary>
</Application.Resources>
使用它在StackLayout
<StackLayout Orientation="Vertical" BackgroundColor="{StaticResource Primary}">
'樣式'會希望'StyleTemplate'作爲它的資源。你只是想要而已; ' ' –
是的,但它不工作在那種模式 –
模式?它可能想要一個類型爲'Brush'的資源而不是'Color'類型? –