Forum Xamarin.Forms

Styling stripeview in Xamarin.Forms

I'm using Stripe in a Xamarin.Forms app. I'd like to change the stripe view styles, like for instance text color.

I added this to the App.xaml markup:

<Style TargetType="Label">
  <Setter Property="TextColor" Value="#C0C0C0" />
</Style>

And I can see the text color applied to all the entries in my app, but the stripeview.

I'm using a light theme, with white background, and the font color in the stripeview control is also white, so I can't see anything.

Any ideas?

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I'm clearly missing something obvious.
    Your style applies to a Label and you're wondering why it doesn't work on a StripeView.
    They're two different types.
    Its kind of like saying "I made a style for a Label, why doesn't it apply to a BoxView?"
    So I guess my question to you is: Why would you think it should apply?

  • You are right Clint, I didn't explain myself properly.

    I'm not expecting the Style for Label to apply to the stripview. I just want to know if it's possible to apply styles to the stripeview control as I do with Labels. Sorry I wasn't clear enough.

    Creating a style with target type equals to stripview didn't work. I tried with something like:

    <Style TargetType="local:StripeView"> <Setter Property="TextColor" Value="{ StaticResource DefaultFontColor }" /> </Style>

    And I got this error.

    Xamarin.Forms.Xaml.XamlParseException: Position 33:17. Can't resolve TextColorProperty on StripeView

    I guess the right question would be, which is the right TargetType to use in this case.

Sign In or Register to comment.