I have the following style defined in my Content Page:
<ContentPage.Resources>
<ResourceDictionary>
<Style TargetType="{x:Type ContentView}" x:Key="ColorScaleGordura">
<Setter Property="Content">
<Setter.Value>
<StackLayout Orientation="Horizontal" Padding="15,0,15,0" HorizontalOptions="Center" Spacing="15" HeightRequest="30">
<Frame BackgroundColor="{StaticResource ColorScaleRed}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleDarkOrange}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleOrange}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleYellow}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleLightGreen}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleGreen}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
<Frame BackgroundColor="{StaticResource ColorScaleDarkGreen}" Style="{StaticResource NutrientColorFrameStyle}">
<Label Text="G" Style="{StaticResource NutrientInitialsStyle}"/>
</Frame>
</StackLayout>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ContentPage.Resources>
This is what it is supose to look like:
I've made this as a Style because I need it to repeat a lot of times through the page. I am using it like this:
<ContentView Style="{StaticResource ColorScaleGordura}"/>
And it works! But only once. No matter where in my page I paste the code line above, only one will work (usually the one further down the page). If I do something like this:
<StackLayout>
<Label Text="test1"/>
<ContentView Style="{StaticResource ColorScaleGordura}"/>
<StackLayout>
<Label Text="test2"/>
<ContentView Style="{StaticResource ColorScaleGordura}"/>
<StackLayout>
<Label Text="test3"/>
<ContentView Style="{StaticResource ColorScaleGordura}"/>
</StackLayout>
</StackLayout>
</StackLayout>
This is what I get:
What am I missing?