# Persistant height of rectangle while using Change on SwipeGesture

**URL:** <https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729>\
**Category:** How-to Discussions\
**Created:** [February 25, 2016, 8:53pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729 "2016-02-25T20:53:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ck3k](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ck3k](https://forums.fusetools.com/u/ck3k)\
**Post date:** [February 25, 2016, 8:53pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/1 "2016-02-25T20:53:10Z")

</div>

Hey, I’m relatively new to Fuse, just installed it and learning. While building a simple mobile app I came to a problem which I can’t find solution for on documentation page.

Lets say I have this:

```auto
<StackPanel Alignment="Bottom">
    <Rectangle ux:Name="botPan" Fill="#534444" Height="150" Alignment="Bottom" Opacity="0.65">
        <!--<Clicked>
            <Set botPan.Height="200" Delay="1" /> 
            <Set botPan.Height="200" />
        </Clicked>-->

        <SwipeGesture ux:Name="swipePan" Direction="Up" Length="100" />
        <SwipingAnimation Source="swipePan">
            <Change botPan.Height="200" />
        </SwipingAnimation>
        ....
    </Rectangle>

```

So, the height of the rectangle is working fine when swiping up, but, I want to have persistant height of it and in this example, it returns to it’s original heigh after I remove my finger. I know I can use \< Set botPan.Height\> but there is no animation there.

So my questions is:  
Is there a way to use \< Change \> to set a persistant value, and then use \< SwipeGesture \> to bottom to set it to default.

OR

Should I use \< Set \> to set a persistant value, but in this case, how do I animate the swiping animation?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![ck3k](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ck3k](https://forums.fusetools.com/u/ck3k)\
**Post date:** [February 25, 2016, 9:02pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/2 "2016-02-25T21:02:55Z")

</div>

Edit:  
 ![this](http://i.imgur.com/5Tppvhr.gif)

---

<div class="post-metadata">

**Author:** ![ck3k](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ck3k](https://forums.fusetools.com/u/ck3k)\
**Post date:** [February 25, 2016, 9:42pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/3 "2016-02-25T21:42:19Z")

</div>

Solved!

Thanks to @fahad & @86fernandolins from slack @ #general.

```auto
        <SwipeGesture ux:Name="swipePan" Direction="Up" Length="100" />
        <SwipingAnimation Source="swipePan">
                <Toggle Target="togglePanUp" />
        </SwipingAnimation>

        <WhileTrue ux:Name="togglePanUp">
            <Change botPan.Height="200"
                Duration="0.1"/>
        </WhileTrue>

```

---

<div class="post-metadata">

**Author:** ![edA-qa\_mort-ora-y](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/eda-qa_mort-ora-y/32/124_2.png) [@edA-qa\_mort-ora-y](https://forums.fusetools.com/u/edA-qa_mort-ora-y)\
**Post date:** [February 26, 2016, 9:13am UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/4 "2016-02-26T09:13:43Z")

</div>

You may instead be looking for the `Type="Active"` property on the `SwipeGesture`. This creates a tray-like swiping gesture instead. The user can swipe to open/close the tray. When open your `SwipingAnimation` will be applied to 100% until the user closes it.

You can also use the `SetSwipeActive` and `ToggleSwipeActive` to programmatically modify the open/closed state of the gesture. There is also `WhileSwipeActive` which is active while the gesture is “open”.

In any case, if you decide to keep using the toggle you have now, you should not use `SwipingAnimation` to do these. Placing actions inside such triggers is a delicate situation – it is deterministic and defined, but rarely what you want. Use the `Swiped` trigger instead.

```auto
<Swiped Source="swipePan">
    <Toggle Target="togglePanUp"/>
</Swiped>

```

---

<div class="post-metadata">

**Author:** ![ck3k](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ck3k](https://forums.fusetools.com/u/ck3k)\
**Post date:** [February 26, 2016, 3:21pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/5 "2016-02-26T15:21:08Z")

</div>

I learn something every day. Swiped also worked which is great to see, especailly if it’s more appropriate for this situation, but I question tied to this:

How would I make the Swipe bi-directional? For example, using `<Swiped>` currently works, but what should I do if I want to make a gesture down (swipe down) to make tray close? Currently, both opening and closing the tray works if I swipe up. Opening should be as current, swipe up, but closing should be swipe down.

Thank you for the input.  
Cheers.

---

<div class="post-metadata">

**Author:** ![edA-qa\_mort-ora-y](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/eda-qa_mort-ora-y/32/124_2.png) [@edA-qa\_mort-ora-y](https://forums.fusetools.com/u/edA-qa_mort-ora-y)\
**Post date:** [February 26, 2016, 4:53pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/6 "2016-02-26T16:53:40Z")

</div>

That’s what the `Type="Active"` does for you automatically. Just make a `SwipingAniamtion` that exposes the panel and nothing more – put your Height change directly in the swiping animation.

This will be a panel that swipes up to open and down to close.

---

<div class="post-metadata">

**Author:** ![ck3k](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ck3k](https://forums.fusetools.com/u/ck3k)\
**Post date:** [February 26, 2016, 6:23pm UTC](https://forums.fusetools.com/t/persistant-height-of-rectangle-while-using-change-on-swipegesture/4729/7 "2016-02-26T18:23:36Z")

</div>

Thats awesome and I love your approach!

I thought I need to set `Type="Active"` to the `SwipingAnimation` itself, but I was wrong. For others: The `Type="Active"` actually goes to `<SwipeGesture>`.

Thank you and kind regards.
