小编Ale*_*jas的帖子

如何从全球资源中使用颜色?

我想在 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)

xaml colors resourcedictionary xamarin.forms

5
推荐指数
1
解决办法
2286
查看次数

标签 统计

colors ×1

resourcedictionary ×1

xamarin.forms ×1

xaml ×1