# "No implicit cast from 'MainView' to Uno.UX.PropertyObject" error \[0.20.2\]

**URL:** <https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677>\
**Category:** Bug Reports\
**Created:** [June 3, 2016, 12:52am UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677 "2016-06-03T00:52:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fernando\_Lins](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/fernando_lins/32/597_2.png) [@Fernando\_Lins](https://forums.fusetools.com/u/Fernando_Lins)\
**Post date:** [June 3, 2016, 12:52am UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/1 "2016-06-03T00:52:36Z")

</div>

Hi,

I’m upgrading my project from 0.12.4 to 0.20.2 and have followed the upgrade guide. However one last error remains when I try to preview my project:

```auto
Configuring (5.61s)
Compiling syntax tree
C:\Users\fernandolins\OneDrive\Documentos\GitHub\TowardPrototipo\build\Local\Preview\cache\TowardDemo.unoproj.g.uno(806.66): E2047: No implicit cast from 'MainView' to Uno.UX.PropertyObject
(0.95s)

Build completed in 6.57 seconds.
    0 Warning(s)
    1 Error(s)

# Build complete.

```

I’m really not sure what the error is about. I am using the same `.unoproj` format as specified in the upgrade guide:

```auto
{
  "Packages": [
    "Fuse",
    "FuseJS",
    "Fuse.BasicTheme"
  ],
  "Includes": [
    "*"
  ]
}

```

---

<div class="post-metadata">

**Author:** ![james1](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@james1](https://forums.fusetools.com/u/james1)\
**Post date:** [June 3, 2016, 1:28pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/2 "2016-06-03T13:28:07Z")

</div>

Hi, I’v got the same problem on my project after upgrading from 0.12.4 to 0.20.2

---

<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:** [June 6, 2016, 5:19am UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/3 "2016-06-06T05:19:45Z")

</div>

Hi guys,

This is strange, but it sounds like you are databinding to properties on the App tag itself, which won’t work in the current version.

If that’s not the case, can you please provide a test project?

---

<div class="post-metadata">

**Author:** ![Fernando\_Lins](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/fernando_lins/32/597_2.png) [@Fernando\_Lins](https://forums.fusetools.com/u/Fernando_Lins)\
**Post date:** [June 6, 2016, 12:15pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/4 "2016-06-06T12:15:09Z")

</div>

Hi Anders,

Here is my project so you can debug it: [https://dl.dropboxusercontent.com/u/2273140/fernandolins86\_prototype.zip](https://dl.dropboxusercontent.com/u/2273140/fernandolins86_prototype.zip)

It is quite extensive and far from the best code you’ll see because it’s pretty much a collection of UI behaviors. As you will see the `<App>` tag has no databinding in it.

By the way my code uses this replacement for Styles; I’m not sure if it could be the cause: [https://www.fusetools.com/community/forums/howto\_discussions/resources\_in\_their\_own\_file\_replacement\_for\_style?page=1](https://www.fusetools.com/community/forums/howto_discussions/resources_in_their_own_file_replacement_for_style?page=1)

Thanks!

---

<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:** [June 6, 2016, 1:19pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/5 "2016-06-06T13:19:20Z")

</div>

Hi!

The problem is that `TabSinc.ux` refers to `this.Background` which implies the backgorund color of the `App` itself. Properties on `App` can not be used in bindings, unfortunately. Instead of using `App.Background`, consider using a root panel with a background.

---

<div class="post-metadata">

**Author:** ![Fernando\_Lins](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/fernando_lins/32/597_2.png) [@Fernando\_Lins](https://forums.fusetools.com/u/Fernando_Lins)\
**Post date:** [June 6, 2016, 8:53pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/6 "2016-06-06T20:53:49Z")

</div>

Hello,

I added a Background to the `ClientPanel` inside of `<App>`, and also tried adding a new `Panel` with the Backgroud property inside the `ClientPanel`, but the error still appears.

I checked the documents where I used `this.SomeProperty` but they all have parent nodes; shouldn’t they be getting the property from their parents? The `this.Background` you mentioned above is inside a `TWButton` which is a `Panel` that already contains a background defined in `ElementosUI.ux`.

---

<div class="post-metadata">

**Author:** ![Fernando\_Lins](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/fernando_lins/32/597_2.png) [@Fernando\_Lins](https://forums.fusetools.com/u/Fernando_Lins)\
**Post date:** [June 7, 2016, 10:44pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/7 "2016-06-07T22:44:17Z")

</div>

Hi Anders,

After a little more digging I am now getting errors related to the keys set on the ResourceContainer class (and the previous error is gone):

```auto
C:\Users\user\Documents\GitHub\TowardPrototipo\TowardPrototipo\ElementosUI.ux(135): E8001: 'this' declared in Cores.ux(1) is a member 'CoresInclude' and cannot be accessed from 'TWButton'. To make this work, consider making 'TWButton' an ux:InnerClass of 'CoresInclude'.

C:\Users\user\Documents\GitHub\TowardPrototipo\TowardPrototipo\ElementosUI.ux(135): E8001: 'this' does not contain property 'TextLabel'
TowardDemo: E0000: Object reference not set to an instance of an object.

```

This is the code block:

```auto
<Panel ux:Class="TWButton" HitTestMode="LocalVisualAndChildren" Background="{Resource branco}" FontSize="14" TextColor="{Resource azul00}" TextAlignment="Center" Padding="12" Margin="0,6,0,6" Focus.IsFocusable="true" ux:Name="_thisTWBInstance">
        <float4 ux:Property="Background" />
        <float4 ux:Property="TextColor" />
        <string ux:Property="TextLabel" />
        <TextAlignment ux:Property="TextAlignment" />
        <float ux:Property="FontSize" />

<!-- LINE 135 BELOW -->
        <Text Value="{Property this.TextLabel}" TextColor="{Property this.TextColor}" TextAlignment="{Property this.TextAlignment}" Alignment="Center" FontSize="{Property this.FontSize}" ux:Name="_thisText" Margin="0" Padding="0"/>

        <Rectangle CornerRadius="4" Layer="Background">
            <SolidColor Color="{Property this.Background}" ux:Name="_thisBackground"/>
            <Stroke Color="{Property this.TextColor}" Width="1" ux:Name="_thisStroke"/>
        </Rectangle>

        <WhileFocused>
            <Change Target="_thisStroke.Width" Value="2"/>
        </WhileFocused>

        <WhilePressed>
            <Change Target="_thisStroke.Color" Value="{Property this.Background}" Duration="0" DurationBack="0.3" Easing="CubicOut"/>
            <Change Target="_thisBackground.Color" Value="{Property this.TextColor}" Duration="0" DurationBack="0.3" Easing="CubicOut"/>
            <Change Target="_thisText.TextColor" Value="{Resource branco}" Duration="0" DurationBack="0.3" Easing="CubicOut"/>
        </WhilePressed>
    </Panel>

```

This is Cores.ux basically:

```auto
<ResourceContainer ux:Class="CoresInclude">
    <float4 ux:Value="#0D1C2F" ux:Key="azul03" />
    <float4 ux:Value="#1A385D" ux:Key="azul02" />
    <float4 ux:Value="#26548B" ux:Key="azul01" />

    <!-- other floats listed ... -->

    <float4 ux:Value="#FFFFFF" ux:Key="branco" />
    <float4 ux:Value="#000000" ux:Key="preto" />
</ResourceContainer>

```

---

<div class="post-metadata">

**Author:** ![Fernando\_Lins](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/fernando_lins/32/597_2.png) [@Fernando\_Lins](https://forums.fusetools.com/u/Fernando_Lins)\
**Post date:** [June 9, 2016, 5:56pm UTC](https://forums.fusetools.com/t/no-implicit-cast-from-mainview-to-uno-ux-propertyobject-error-0-20-2/677/8 "2016-06-09T17:56:53Z")

</div>

**Resolution**

As of 0.20, you can only use `this` to refer to a parent element that has a `ux:Class`. If it is not found, it will look up the parent nodes for an `ux:Class` and if none is found, it will eventually reach the `App` tag which cannot have its properties targeted.

So this behavior which was accepted in 0.12.x has now changed and will cause this problem.

To fix it, give your element an `ux:Name` and use that to access its properties (e.g. `this.Background` ==\> `myElementsUxName.Background`) instead of the now deprecated behavior of `this`.

THank you @duckers!
