在App.xaml中我有這樣的代碼:如何從Xamarin Forms中的C#中的App.xaml訪問顏色?
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Yellow">#ffd966</Color>
</ResourceDictionary>
</Application.Resources>
,並在C#我有這樣的代碼:
public Color BackgroundColor
{
get { return IsSelected ? Color.Yellow : Color.White; }
}
而且我想改變Color.Yellow從App.xaml中的顏色。我如何從C#中的App.xaml中引用顏色?
isSelected? (顏色)Application.Current.Resources [「Yellow」]:Color.White; – Dilmah
你可以發表一個答案,我會接受它 – Uros