I've been working an a Xamarin.Forms application and I noticed that I have two options for applying styles. I can create a Style with a "class" property and use it with an elements "StyleClass" property like so:
<Style Class="GenericButton" TargetType="Button">
<Setter Property="BackgroundColor" Value="Orange"/>
</Style>
<Button StyleClass="GenericButton" Command="{Binding LoginCommand}" Text="Login" />
Or, I can write a Style with "x:Key" and use it with the "Style" property set to a static resource:
<Style x:Key="GenericBut" TargetType="Button">
<Setter Property="BackgroundColor" Value="Azure"/>
</Style>
<Button Style="{StaticResource GenericBut}" Command="{Binding LoginCommand}" Text="Login" />
Either one seems to work, but I don't know which to use in general, and I cannot find the proper documentation on their purposes. StyleClass is an IList and I believe it applies styles like CSS, which seems useful, but I'm wondering if there would be unforeseen consequences of using it all the time.
Thanks