Expose properties from Code-Behind to the UX

Hello,

I’m trying to extend some of my UX classes with some UNO code-behind, and I’d like to know if there’s a way for me to expose properties that I can then bind-to in my UX file. Here’s an example:

I have a custom class that has the Title string property.

<Panel ux:Class="FormInput" ux:Name="self">
  <string ux:Property="Title"/>
</Panel>

In Code-Behind, I added the following property to the partial class:

public partial class FormInput {
  public string TitleUppercase {
    get { return this.Title ?? this.Title.ToUpper(); }
  }
}

I would now expect to be able to do this within my custom class:

<Text Value="{Property self.TitleUppercase}"/>

But the compiler doesn’t accept this and tells me the property doesn’t exist.

Is there any other way to achieve something similar (I’m just starting, so I’m probably missing something)?

Hi,

This is only possible if you move your Uno-based components into a separate project. You cannot declare a component in UX, use Uno code behind, and then use that component again from UX, within the same project.