muak / AiForms.Effects

AiForms.Effects for Xamarin.Forms
MIT License
245 stars 27 forks source link

Effects does not work after changing Content. #14

Closed mrxten closed 7 years ago

mrxten commented 7 years ago

My page has different ContentViews for both orientations. I added ripple effect for both. After changing Content in a page to another ContentView ripple effect ceases to work.

mrxten commented 7 years ago

ex. Vertical orientation - works changed to horizontal orientation - works changed back to vertical - does not works.

muak commented 7 years ago

@mrxten Sorry, I don't know your situation much. Could you paste some code?

mrxten commented 7 years ago

Try rotate phone. After rotating vertical -> horizontal -> vertical your effects will not work in any elements. ex.

Main.page.cs

public class Main()
{
        private readonly View _horizontalView = new HorizontalView();
        private readonly View _verticalView = new VerticalView();

        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);
            Content = Width > Height ? _horizontalView : _verticalView;
        }
}

VerticalView.xaml

<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:partials="clr-namespace:VisuPad2.Views.Dashboard.Partials;assembly=VisuPad2"
             xmlns:extensions="clr-namespace:VisuPad2.Extensions;assembly=VisuPad2"
             x:Class="VisuPad2.Views.Dashboard.Orientation.VerticalView">
    <Grid effects:AddCommand.On="True"
                  effects:AddCommand.EffectColor="LightGray"
                  effects:AddCommand.EnableRipple="True"
                  effects:AddCommand.Command="{Binding SomeCommand}">
    <!--something-->
    </Grid>
</ContentView>

HorizontalView.xaml

<!--something-->
muak commented 7 years ago

@mrxten Thank you for your code. I turned out cause of this issue. I Released Fixed Version 0.2.3. Please try it.

mrxten commented 7 years ago

Yes, it works! Thanks.