Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

ChildStep is set more than once error? #38

Open
colonna-mike opened this issue Feb 11, 2019 · 3 comments
Open

ChildStep is set more than once error? #38

colonna-mike opened this issue Feb 11, 2019 · 3 comments

Comments

@colonna-mike
Copy link

colonna-mike commented Feb 11, 2019

Hello, I have installed XFGloss and when I try to add a gradient step within my xaml file, i get a XAML error telling me that: "The property 'ChildStep' is set more than once."

must likely I forgot a step or two, any help would be great.
note: It does work in the code behind.

Visual studio 2017
Xamarin Forms 3.5.0.129452

here is my XAML code:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xfg="clr-namespace:XFGloss;assembly=XFGloss"
             NavigationPage.HasNavigationBar="false"
            x:Class="amici.Logon">
    
    <xfg:ContentPageGloss.BackgroundGradient>
        <xfg:Gradient Rotation="150">
            <xfg:GradientStep StepColor="White" StepPercentage="0" />
            <xfg:GradientStep StepColor="White" StepPercentage=".5" />
            <xfg:GradientStep StepColor="#ccd9ff" StepPercentage="1" />
        </xfg:Gradient>
    </xfg:ContentPageGloss.BackgroundGradient>
@LeoJHarris
Copy link

Is the sample code incorrect?

@tbaggett
Copy link
Owner

tbaggett commented Mar 26, 2019

I believe there has been a change made to XF that causes this to no longer work. Previously, it was possible to automatically assign gradient steps to a collection by using a custom setter on the designated content property for the Gradient class. See the comments in the source for details.

I will investigate the issue further to see if I can make the convenience property work again. In the meantime, you should wrap the GradientStep declarations inside an xfg:Gradient.Steps tag like this:

<xfg:ContentPageGloss.BackgroundGradient>
    <xfg:Gradient Rotation="150">
        <xfg:Gradient.Steps>
            <xfg:GradientStep StepColor="White" StepPercentage="0" />
            <xfg:GradientStep StepColor="White" StepPercentage=".5" />
            <xfg:GradientStep StepColor="#ccd9ff" StepPercentage="1" />
        </xfg:Gradient.Steps>
    </xfg:Gradient>
</xfg:ContentPageGloss.BackgroundGradient>

<StackLayout>
    <!-- Place new controls here -->
    <Label Text="Welcome to Xamarin.Forms!" 
       HorizontalOptions="Center"
       VerticalOptions="CenterAndExpand" />
</StackLayout>

I created a new project, added the gradient and verified it worked.

@adamhalesworth
Copy link

@tbaggett Thanks for this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants