Hello, I’m currently facing a problem when trying to do a state-based swipe panel.
I have a Grid with name ReaderBottomBar that is only 15% of the height of the screen. When it gets swiped up it should open to 100% … but because there I want to put swipeable content I want to disable the swipe gesture when it’s opened. I was trying to have a WhileTrue with a ux:Name="expanded" that would act as a variable that changes.
The problem is that it seems that the WhileFalse/WhileTrue that works with the expanded element doesn’t seem to be working.
<Grid ux:Name="ReaderBottomBar" Dock="Bottom" ColumnCount="4" Height="15%" Background="#fff">
<WhileTrue ux:Name="expanded" Value="false">
<Change ReaderBottomBar.Height="100" Easing="CubicInOut" Duration="1" DelayBack="0"/>
</WhileTrue>
<!-- Swipe Up, should be enabled when expanded is false -->
<SwipeGesture ux:Name="swipeUpReader" Direction="Up" Length="50" Type="Simple" />
<Swiped Source="swipeUpReader">
<WhileFalse Value="{Property expanded.Value}">
<Set expanded.Value="true" />
<DebugAction Message="Swiped UP!" />
</WhileFalse>
</Swiped>
<!--Swipe down, should be enabled only when its opened...-->
<SwipeGesture ux:Name="swipeDownReader" Direction="Down" Length="50" Type="Simple" />
<Swiped Source="swipeDownReader">
<Set expanded.Value="false" />
</Swiped>
<Clicked>
<WhileFalse Value="{Property expanded.Value}">
<Set expanded.Value="true" />
<DebugAction Message="Clicked!" />
</WhileFalse>
</Clicked>
</Grid>
And the last question, I want that the SwipeDown gesture to be only in a small area of the top of the Grid Element. Thanks!
took a stab at it, and made a slightly better version (with a couple neat tricks that you might find useful) of what you’re trying to make. Let me know if you have any further questions.
Daniel,
I found something I did before for another app, and made into a more generic example, it’s almost the same approach as Uldis, but using a single Active type SwipeGesture. So as I already took my time making it, why not share it here…