我想在 app.xaml 上设置我的资源,然后在应用程序的不同视图中使用它,但是当我设置颜色时应用程序崩溃 uu,有人可以帮助我吗?
应用程序.xaml
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary">#FFC107</Color>
</ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
在 StackLayout 中使用它
<StackLayout Orientation="Vertical" BackgroundColor="{StaticResource Primary}">
Run Code Online (Sandbox Code Playgroud)