https://www.fusetools.com/developers/guides/uxmarkup/usingyourownclasses
I’ve been using this throughout my codebase, but after updating to the latest (0.5.3278) I get “‘TestButton’ does not have a property called ‘Text’” when running the app (not on compile but runtime).
TestButton:
public class TestButton
{
public string Text
{
get...
set...
}
}
Usage:
<TestButton Text="TEST"/>
(I have also tried to define text as a StyleProperty (as in IsMultiline in Text, but no avail)
Has this been removed? In that case, what do you suggest to do?
This works, and your code looks fine - this is how all properties in Fuse are exposed.
For us to debug this you have to provide a more complete test case.
Nothing has been changed with regards to this.
Good to hear, Ill try to extract a testcase from my codebase later today
https://dl.dropboxusercontent.com/u/1881490/CustomMemberTest.zip
Simple testcase
When running preview nothing happens until after a couple of seconds where a window pops up in sublime with
- Auto Reload Result -
'TestButton' does not have a property called 'Text' - ...\CustomMemberTest\MainView.ux(3:1):E
When removing the Text=“Hallo” from the testbutton in mainview, it runs fine.
Hi,
Code behinds do not take effect in preview within the same project. This is because code behinds can not be simulated with live preview, they need to be recompiled when changed.
If you want to create components using UX+Uno code behinds, you need to set this up as two separate projects. Your UI components in one project, and your top level app in another, and add a reference to your components project from your main app.
Whenever you change the component code you’ll have to restart Fuse preview.
Code behinds do however take effect in regular builds (not preview), for example:
uno build --target=DotNetExe --run
This approach does not require the two-project set-up, but then again, doesn’t give you live preview.
Ah ok I see. Well I’ll just use the normal builds for now then. Way to heavily invested in code behinds atm, but pulling out components in its own project might be a good idea no matter what.