when swiping from bottom of screen, taskbar should be visible – UWP
For your requirement, you need detect the taskbar‘s ManipulationDelta
event, and if Cumulative.Translation.Y more than your threshold then invoke double animation to move taskbar down or up.
For example
private bool _isSwiped;
private void StackPanel_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
if (e.IsInertial && !_isSwiped)
{
var swipedDistance = e.Cumulative.Translation.Y;
if (Math.Abs(swipedDistance) <= 2) return;
if (swipedDistance > 0)
{
Debug.WriteLine("down Swiped");
DownAnimiation.Begin();
}
else
{
UpAnimation.Begin();
Debug.WriteLine("up Swiped");
}
_isSwiped = true;
}
}
private void StackPanel_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e)
{
_isSwiped = false;
}
Xaml Code
<Grid>
<Grid.Resources>
<Storyboard x:Name="DownAnimiation">
<DoubleAnimation
Storyboard.TargetName="BottomPanel"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
To="93"
Duration="0:0:0.5">
<DoubleAnimation.EasingFunction>
<BackEase />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
<Storyboard x:Name="UpAnimation">
<DoubleAnimation
Storyboard.TargetName="BottomPanel"
Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
To="0"
Duration="0:0:0.5">
<DoubleAnimation.EasingFunction>
<BackEase />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</Grid.Resources>
<StackPanel
x:Name="BottomPanel"
Height="95"
Margin="5"
VerticalAlignment="Bottom"
Background="PaleGreen"
CornerRadius="5"
ManipulationCompleted="StackPanel_ManipulationCompleted"
ManipulationDelta="StackPanel_ManipulationDelta"
ManipulationMode="TranslateY,TranslateInertia,System">
<StackPanel.RenderTransform>
<CompositeTransform />
</StackPanel.RenderTransform>
</StackPanel>
</Grid>
1
solved when swiping from bottom of screen, taskbar should be visible – UWP [closed]