# Change an Observable from Uno

**URL:** <https://forums.fusetools.com/t/change-an-observable-from-uno/2935>\
**Category:** How-to Discussions\
**Created:** [November 9, 2015, 11:36am UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935 "2015-11-09T11:36:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjorn-Olav\_Strand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bjorn-olav_strand/32/583_2.png) [@Bjorn-Olav\_Strand](https://forums.fusetools.com/u/Bjorn-Olav_Strand)\
**Post date:** [November 9, 2015, 11:36am UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935/1 "2015-11-09T11:36:00Z")

</div>

Hi,

Does anyone have any examples on changing an Observable from Uno code? I’ve tried several things, but I doesn’t change in JS.

- Bjørn-Olav

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [November 9, 2015, 3:37pm UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935/2 "2015-11-09T15:37:22Z")

</div>

Hi,

If you have a `Fuse.Scripting.Object` which is the `Observable`, you should be able to do

```auto
obj.CallMethod("setValueExclusive", value);

```

---

<div class="post-metadata">

**Author:** ![Bjorn-Olav\_Strand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bjorn-olav_strand/32/583_2.png) [@Bjorn-Olav\_Strand](https://forums.fusetools.com/u/Bjorn-Olav_Strand)\
**Post date:** [November 9, 2015, 8:34pm UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935/3 "2015-11-09T20:34:40Z")

</div>

Hi,

I would like to have a UX like this:

```auto
<MyAwesomeElement Property="{js_prop}" />

```

And then change that from Uno. I’ve tried this:

```auto
foreach (var b in Behaviors) {
    if (b is Fuse.Reactive.DataBinding<float2>) {
        var db = b as Fuse.Reactive.DataBinding<float2>;
        db.Unknown(newvalue);
    }
}

```

This is my other try, using `StyleProperty`:

```auto
    public static readonly StyleProperty<BindPanel, float2> SizeProperty
        = new StyleProperty<BindPanel, float2>(float2(0,0), null, SetSize, GetSize);

    float2 _size = float2(0,0);
    public float Size
    {
        get { return _size; }
        set { 
            SizeProperty.Set(this, value);
        }
    }

    static float2 GetSize(BindPanel p)
    {
        return p._size;
    }

    static void SetSize(BindPanel p, float2 size)
    {
        p._size = size;
    }

    public void SetSize(float2 size, object origin)
    {
        _size = size;
        SizeProperty.SetLocalState(this);
    }

```

But still no luck.

---

<div class="post-metadata">

**Author:** ![Anders\_Lassen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_lassen/32/522_2.png) [@Anders\_Lassen](https://forums.fusetools.com/u/Anders_Lassen)\
**Post date:** [November 9, 2015, 11:08pm UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935/4 "2015-11-09T23:08:15Z")

</div>

What you are trying to do is sort of an antipattern. JS feeds the UI with values, not the other way around. The only exception is two-way data binding-enabled properties like `TextInput.Value`, but I don’t think that covers this case either.

Can you instead try to describe what you are ultimately trying to do here? What is the use case?

---

<div class="post-metadata">

**Author:** ![Bjorn-Olav\_Strand](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/bjorn-olav_strand/32/583_2.png) [@Bjorn-Olav\_Strand](https://forums.fusetools.com/u/Bjorn-Olav_Strand)\
**Post date:** [November 10, 2015, 7:52am UTC](https://forums.fusetools.com/t/change-an-observable-from-uno/2935/5 "2015-11-10T07:52:09Z")

</div>

I am trying to do something like this:

```auto
<App>
    <JavaScript>
        var Observable = require('FuseJS/Observable');

        var size = Observable([0,0]);
        var imageurl = Observable('');
        function setUrl () {
            imageurl.value = 'http://example.com/dynamicimage?w=&#39; + size.value.X + '&h=' + size.value.Y;
        }

        module.exports = {
            size: size,
            imageurl: imageurl
        }
    </JavaScript>
    <Panel Size="{size}">
        <Image Url="{imageurl}" />
    </Panel>
</App>

```
