# Changing Button's HitTestMode from within a WhileFalse trigger doesn't work

**URL:** https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189
**Category:** Bug Reports
**Created:** [June 13, 2016, 12:14pm UTC](https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189 "2016-06-13T12:14:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jveres](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/jveres/32/545_2.png) [@jveres](https://forums.fusetools.com/u/jveres)
#### Post date: [June 13, 2016, 12:14pm UTC](https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189/1 "2016-06-13T12:14:02Z")

</div>

I have a basic scenario:

```auto
<Basic.Button ux:Name="button" Text="Button"" HitTestMode="LocalBounds" Opacity="1" Clicked="{doSomething}"/>
<WhileFalse Value="{isButtonEnabled}">
  <Change button.Opacity="0.5" Duration="0.2" Delay="0" />
  <Change button.HitTestMode="None" Duration="0" Delay="0" DurationBack="0" DelayBack="0" />
</WhileFalse>

```

Starting with `isButtonEnabled.value=false;` and then toggling this `Observable` opacity changes as expected but its `HitTestMode` property doesn’t change, or at least the button remains unclickable.

Any idea what am I doing wrong?

---

<div class="post-metadata">

### Author: ![Vegard\_Strand\_Lende](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/vegard_strand_lende/32/349_2.png) [@Vegard\_Strand\_Lende](https://forums.fusetools.com/u/Vegard_Strand_Lende)
#### Post date: [June 13, 2016, 12:59pm UTC](https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189/2 "2016-06-13T12:59:18Z")

</div>

Does it happen with `Duration` and `DurationBack` set to a value larger than `0`?

On a sidenote, if you want to instantly set the `HitTestMode` when your bool changes I would recommend this approach instead:

```auto
<WhileFalse Value="{isButtonEnabled}">
    <Set button.HitTestMode="None" />
</WhileFalse>
<WhileTrue Value="{isButtonEnabled}">
    <Set button.HitTestMode="LocalBoundsAndChildren" />
</WhileTrue>

```

---

<div class="post-metadata">

### Author: ![Fahad](https://avatars.discourse-cdn.com/v4/letter/f/ecccb3/32.png) [@Fahad](https://forums.fusetools.com/u/Fahad)
#### Post date: [June 13, 2016, 1:37pm UTC](https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189/3 "2016-06-13T13:37:00Z")

</div>

Hey,

The way I usually do this is by actually changing `button.Visibility="Collapsed"` so that you can’t touch it and then `button.Visibility="Visible"` so that you can.

---

<div class="post-metadata">

### Author: ![jveres](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/jveres/32/545_2.png) [@jveres](https://forums.fusetools.com/u/jveres)
#### Post date: [June 13, 2016, 2:00pm UTC](https://forums.fusetools.com/t/changing-buttons-hittestmode-from-within-a-whilefalse-trigger-doesnt-work/4189/4 "2016-06-13T14:00:34Z")

</div>

@vegard: I tried every combination without luck and I observed the following behaviour: as this is a part of a Page, the button becomes touchable if I navigate back and forth once. Then, disabling and enabling the Button works as it should. The `isButtonEnabled` is an observable function returning boolean, probably it makes a difference. Probably changing a `Basic.Button`'s `HitTestMode` interferes with the default sytle settings.

@fudge: thanks for your reply, `Visibility` works indeed, however I need to change `HitTestMode` in this case:)
