Styles are not applying in the CarouselView class. Have not tried CardsView.
This is the style I have been trying to apply.
<Style TargetType="panCardView:CarouselView">
<Setter Property="IsCyclical" Value="False"/>
</Style>
In trying this, I have tried to use the style as an Implicit, Explicit and referencing it by using the StaticResource and giving it a x:Key to reference the style by. None of the methods of applying a style works.
P.S. Styling the IndicatorControl does work and works very well.
P.P.S Love the package though! Keep up the good work
Looking more into it, it seems like the style is being applied, because I can change the BackgroundColor via the style. Since the IsCyclical and 2 other properties are being set in the constructor of the CarouselView as default values, that will overwrite any style applied that modifies any of those 3 properties.
@tdoell nice catch! Thanks for the info.
Hm, how can we solve it? Any ideas?
Some coworkers and I have come up with a solution in a package we have made for work, because we experienced the same issue. I can provide a pull request either this afternoon or in the morning with the proposed fix.
@tdoell it would be interesting to see it.
But it looks like XF issue.
@tdoell i found a workaround - Force set Style's properties
The solution we came up with is to provide an instance method in the CardsView class that CarouselView or another view can override that provides the default value for the properties.
Then in the BindableProperty.Create declarations, you would refer to the bindable instance and call the default value method.
Example
```c#
public static readonly BindableProperty IsCyclicalProperty = BindableProperty.Create(nameof(IsCyclical), typeof(bool), typeof(CardsView), defaultValueCreator: (bindable as CardsView).GetIsCyclicalDefaultValue());
protected virtual bool GetIsCyclicalDefaultValue() => false;
```
Then the CarouselView class could override that method and provide its own default value.
@tdoell cool. Do you want to make PR ?
Your solution is proper way to achieve it!
public static readonly BindableProperty MoveWidthPercentageProperty = BindableProperty.Create(nameof(MoveWidthPercentage), typeof(double), typeof(CardsView), defaultValueCreator: b => b.AsCardsView().DefaultMoveWidthPercentage);
protected virtual double DefaultMoveWidthPercentage => 0.325;
I prefer virtual getter properties (lambda style)
protected virtual properties should located AFTER CurrentInactiveBackViews (after private ones)
Yeah I can make a PR for those 3 properties if you would like. And I can make default value as properties like you just specified with the DefaultMoveWidthPercentage example.
Okay I will get to work on that.
@tdoell for those 2 properties :) as the first one wan't designed by me. It's Layout's own. We cannot modify it.
But don't worry. this property should stay true for carousel
Yeah... 2 properties. I just did a quick look and saw the 3. IsClippedToBounds is for sure XF's property!