【发布时间】:2018-03-07 10:22:18
【问题描述】:
我在 Xamarin Forms App 中制作了这样的颜色资源:
<Application ...>
<Application.Resources>
<Color x:Name="ColorLineSeparator">#cccccc</Color>
</Application.Resources>
</Application>
我想像这样在 MainPage.xaml 中使用它:
<BoxView
HeightRequest=".5"
HorizontalOptions="FillAndExpand"
BackgroundColor="[HOW TO USE IT HERE?]"/>
原来的 WPF 会这样处理这个问题:
<Button Background="{DynamicResource ResourceKey=ColorLineSeparator}" />
但它似乎在 Xamarin 表单页面中不起作用。 它显示此错误:
找不到“ResourceKey”的属性、可绑定属性或事件,或者 值和属性的类型不匹配。
【问题讨论】:
标签: xamarin.forms