【发布时间】:2018-08-22 18:48:35
【问题描述】:
我有这个 XAML,我正在尝试将其转换为自定义控件:
这个作品:
<Label Style="{StaticResource MaterialFontIcon}" />
我在下面写了这个,但风格没有通过:
public class MaterialLabel: Label
{
public MaterialLabel()
{
this.Style = {How to access a app.xaml defined style}???;
}
参考:
<me:MaterialLabel Style="{StaticResource MaterialFontIcon}" />
【问题讨论】:
-
Style 和 StyleClass 是两个不同的东西,对吧?
-
如果它在您的 App.xaml 中,您可以使用
this.Style = Application.Current.Resources["MaterialFontIcon"] as Style;
标签: xamarin xamarin.forms