Skip to content

Commit

Permalink
A little bit of polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
Keflon committed Feb 18, 2024
1 parent 3f742c8 commit d750d0c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static void TopViewNameChanged(BindableObject bindable, object oldValue,
var self = (MultiViewZero)bindable;

// TODO: Find the current view.

bool flag = false;
foreach (IView item in self)
{
if (item is View theChildView)
Expand All @@ -117,12 +117,15 @@ private static void TopViewNameChanged(BindableObject bindable, object oldValue,
{
theChildView.IsVisible = true;
self.SetTopView(theChildView);
flag = true;
}
else if (item != self.PreviousView && item != self.CurrentView)
theChildView.IsVisible = false;
}
}
}
if (flag == false)
self.SetTopView(null);
}

private void SetTopView(View theChildView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SampleApp.Mvvm.PageViewModels.MultiView
{
public class MultiViewModalPageVm : BasePageVm
{
private string[] _modalViewNames = { "first", "none", "second", "none" };
private string[] _modalViewNames = { "first", "second", "third", "fourth" };
private int _modalViewIndex = 0;
private string _topViewName;

Expand Down
20 changes: 7 additions & 13 deletions SampleApp/Mvvm/Pages/MultiView/MultiViewModalPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
x:Class="SampleApp.Mvvm.Pages.MultiView.MultiViewModalPage"
Title="MultiViewModalPage">
<Grid Grid.RowDefinitions="*,*">
<cz:MultiViewZero Grid.Row="0" TopViewName="{Binding TopViewName}" InDuration="400" OutDuration="400" BackgroundColor="Blue">
<cz:MultiViewZero Grid.Row="0" TopViewName="{Binding TopViewName}" InDuration="300" OutDuration="300" BackgroundColor="Blue">

<cz:MultiViewZero.InAnimations>
<cz:MultiViewAnimation
Expand All @@ -16,10 +16,7 @@
Expression="CurrentView.Opacity=value,CurrentView.TranslationX=(1-value)*Width/20"
FinishedExpression="CurrentView.Opacity=1,CurrentView.TranslationX=0"
>

</cz:MultiViewAnimation>


</cz:MultiViewZero.InAnimations>

<cz:MultiViewZero.OutAnimations>
Expand All @@ -30,44 +27,41 @@
Expression="PreviousView.Opacity=(1-value),PreviousView.TranslationX=value*Width/20"
FinishedExpression=""
>

</cz:MultiViewAnimation>


</cz:MultiViewZero.OutAnimations>

<cz:MultiViewZero.Children>

<Label Text="First" FontSize="42" cz:MultiViewZero.MultiName="first"/>
<Label Text="Second" FontSize="42" cz:MultiViewZero.MultiName="second"/>
<Label Text="None" FontSize="42" cz:MultiViewZero.MultiName="none"/>
<Label Text="Third" FontSize="42" cz:MultiViewZero.MultiName="third"/>
<Label Text="Fourth" FontSize="42" cz:MultiViewZero.MultiName="fourth"/>
</cz:MultiViewZero.Children>

</cz:MultiViewZero>



<cz:MultiViewZero Grid.Row="1" TopViewName="{Binding TopViewName}" InDuration="666" OutDuration="666" BackgroundColor="Yellow">

<!--TODO: Add ItemControlTemplate-->
<cz:MultiViewZero.InAnimations>
<cz:MultiViewAnimation
From="0"
To="1"
EasingFunc="{x:Static Easing.SinInOut}"
EasingFunc="{x:Static Easing.BounceOut}"
Expression="CurrentView.Scale=value"
FinishedExpression="1"
>

</cz:MultiViewAnimation>


</cz:MultiViewZero.InAnimations>

<cz:MultiViewZero.OutAnimations>
<cz:MultiViewAnimation
From="1"
To="0"
EasingFunc="{x:Static Easing.SinInOut}"
EasingFunc="{x:Static Easing.SpringIn}"
Expression="PreviousView.Scale=value"
FinishedExpression="1"
>
Expand All @@ -80,7 +74,7 @@
<cz:MultiViewZero.Children>

<Label Text="First Modal" FontSize="42" Padding="20" TextColor="Black" BackgroundColor="White" cz:MultiViewZero.MultiName="first" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Text="Second Modal" FontSize="42" Padding="20" TextColor="Black" BackgroundColor="White" cz:MultiViewZero.MultiName="second" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Text="Second Modal" FontSize="42" Padding="20" TextColor="Black" BackgroundColor="White" cz:MultiViewZero.MultiName="third" VerticalOptions="Center" HorizontalOptions="Center"/>
</cz:MultiViewZero.Children>

</cz:MultiViewZero>
Expand Down

0 comments on commit d750d0c

Please sign in to comment.