# Change Target Dynamically from Property

**URL:** https://forums.fusetools.com/t/change-target-dynamically-from-property/4369
**Category:** How-to Discussions
**Created:** [July 13, 2017, 10:33am UTC](https://forums.fusetools.com/t/change-target-dynamically-from-property/4369 "2017-07-13T10:33:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nadzaruddin\_Kahar](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@Nadzaruddin\_Kahar](https://forums.fusetools.com/u/Nadzaruddin_Kahar)
#### Post date: [July 13, 2017, 10:33am UTC](https://forums.fusetools.com/t/change-target-dynamically-from-property/4369/1 "2017-07-13T10:33:59Z")

</div>

I am trying to create a class that receives a Text as a property to animate. The following is what I have.

```auto
<TextInput ux:Class="wow.EditableText">
    <object ux:Property="TargetField" />

    <StateGroup Active="idle" ux:Name="_stategroup">
        <State ux:Name="idle" />
        <State ux:Name="active">
            <Move Target="TargetField" RelativeTo="Size" Y="-0.8" X="-0.01" Duration="0.2" Easing="CubicOut" EasingBack="CubicIn" />
            <Change Target="TargetField.TextColor" Value="#f00" Duration="0.2" Easing="CubicOut" EasingBack="CubicIn" />
        </State>
    </StateGroup>
    <WhileFocused>
        <Change _stategroup.Active="active" />
    </WhileFocused>
    <WhileNotFocused>
        <WhileContainsText>
            <Change _stategroup.Active="active" />
        </WhileContainsText>
    </WhileNotFocused>
</TextInput>

```

And the following is how I call this class.

```auto
<wow.EditableText TargetField="_placeholder"></wow.EditableText>
<Text ux:Name="_placeholder" Value="Username" TextColor="#484848" Margin="10,5,0,0" />

```

But I keep getting the following error message:

```auto
TargetField.TextColor is not a valid property path

```

The Move animation works fine. But it’s just the Change animation cannot capture TargetField.TextColor and when I console.log this property it’s giving me null. So what should I do in order to make this work?

---

<div class="post-metadata">

### Author: ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)
#### Post date: [July 13, 2017, 10:38am UTC](https://forums.fusetools.com/t/change-target-dynamically-from-property/4369/2 "2017-07-13T10:38:29Z")

</div>

You should use [ux:Dependency](https://www.fusetools.com/docs/ux-markup/dependencies) for that.

```auto
<TextInput ux:Class="wow.EditableText">
    <Text ux:Dependency="targetField" />
    ...
    <Change targetField.TextColor="#f00" />

```

and

```auto
<wow.EditableText targetField="_placeholder" />
<Text ux:Name="_placeholder" Value="Username" TextColor="#484848" Margin="10,5,0,0" />

```

---

<div class="post-metadata">

### Author: ![Nadzaruddin\_Kahar](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@Nadzaruddin\_Kahar](https://forums.fusetools.com/u/Nadzaruddin_Kahar)
#### Post date: [July 13, 2017, 10:44am UTC](https://forums.fusetools.com/t/change-target-dynamically-from-property/4369/3 "2017-07-13T10:44:07Z")

</div>

Wow! Thank you so much Uldis. You saved my day. I have been trying to look for this solution. I was hesitant to use ux:Dependency earlier because in the documentation it says it’s immutable. Now it seems to be working.

By the way, is there any easier way to search through hundreds of entries in this forum? If I type more than a keyword the search results just keep getting longer.

---

<div class="post-metadata">

### Author: ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)
#### Post date: [July 13, 2017, 11:00am UTC](https://forums.fusetools.com/t/change-target-dynamically-from-property/4369/4 "2017-07-13T11:00:08Z")

</div>

Yeah, the dependency itself _is_ immutable. Not its properties.

The other question is unrelated, but we are aware of the problem and there are plans to fix it, priorities and resources permitting. For now you could try to workaround with the help of google, by entering something like `"dependency injection" site:fusetools.com`.
