Przy naciśnięciu szybko ikonki do przejścia do nowego widoku otwiera mi się dwa razy ten sam widok . I nie wiem jak sobie z tym poradzić aby otwierał jedynie jeden widok.
Przykładowy przycisk w xaml
<local:AnimatedImage Grid.Column="2" Source="googlemap_view_search.png"
HorizontalOptions="Center" VerticalOptions="Center" Margin="16,0">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding SearchCommand}" />
</Image.GestureRecognizers>
</local:AnimatedImage>
Castomowa animacja przycisku
public class AnimatedImage : Image
{
private const int ANIMATED_TIME = 100;
private const double INITIAL_VALUE = 1;
private const double MAGNIFICATION_VALUE = 1.3;
public static readonly BindableProperty CommandProperty = BindableProperty.Create<AnimatedImage, ICommand>(p => p.Command, null);
public ICommand Command
{
get { return (ICommand)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create<AnimatedImage, object>(p => p.CommandParameter, null);
public object CommandParameter
{
get { return (object)GetValue(CommandParameterProperty); }
set { SetValue(CommandParameterProperty, value); }
}
private ICommand TransitionCommand
{
get
{
return new Command(async () =>
{
this.AnchorX = 0.48;
this.AnchorY = 0.48;
await this.ScaleTo(MAGNIFICATION_VALUE, 50, Easing.Linear);
await Task.Delay(ANIMATED_TIME);
await this.ScaleTo(INITIAL_VALUE, 50, Easing.Linear);
if (Command != null)
{
Command.Execute(CommandParameter);
}
});
}
}
public AnimatedImage()
{
Initialize();
}
public void Initialize()
{
GestureRecognizers.Add(new TapGestureRecognizer()
{
Command = TransitionCommand
});
}
}
}
a korzystam w ViewModel z public DelegateCommand SearchCommand { get; private set; }