Reputation: 2294
I have a Style with target type Grid. I want all Entry child elements within a grid of this style to automatically acquire a particular style.
I've had a look at these:
Styling nested elements in WPF
Apply Style to all child-elements of specific type
The only solution appears to be setting Resources within the parent Style, so this is what I've done:
<Style x:Key="BuggyGrid" TargetType="Grid">
<!-- bunch of property setters -->
<Style.Resources>
<Style TargetType="Entry">
<Setter Property="FontFamily" Value="Arial" />
</Style>
</Style.Resources>
</Style>
However, I get a build error: "No property, bindable property, or event found for 'Resources'".
Why do I get this error?
I'm using Xamarin.Forms 2.3.2.
Upvotes: 3
Views: 1498
Reputation: 6953
The links you have referenced are specific to WPF XAML and do not apply to Xamarin.Forms XAML.
I'm not sure how you would achieve nested styles in Xamarin.Forms.
The only possibility is XamlCSS which I haven't personally used.
https://www.nuget.org/packages/XamlCSS.xamarinforms/2.0.0-pre1
Upvotes: 3