Call ux:Name of another Uno file

How can I call a ux:Name of another Uno file?

Like:

<Change Target="Mytrigger.On" Value="true" />

But Mytrigger is in the Mainview.ux?

Hi,

UX files are classes - which can be instantiated many times, so symbols in other UX files are not globally available, you have to know what instance of Mainview.ux you are talking about.

This means that animators like <Change> can not be used across UX files like this. You have to add a .uno code behind and make sure you have access to the other instance.

In order to give a more specific example I need to see what your project and UX files look like.

Im working on a project very similar to the Data Example (Movie List https://www.fusetools.com/developers/guides/examples/movielist).

I want to change the Value On of a trigger that is in MyApp.ux from MovieEntry.ux.

In the MovieEntry.ux I have this:

<CLicked Handler="Activate" />

In his CodeBehind:

void Activate(object sender, ClickedArgs args)
{
 MyTrigger.On = true;
}

In the MyApp.ux:

<ManualTrigger ux:Name="MyTrigger">
    <Move....... />
<ManualTrigger>

How can achive this? To call MyTrigger.On from MovieEntry.ux??

Thanks!

You need to somehow get access to the MyTrigger on MyApp. This means you need access to an instance of MyApp from the MovieEntry (dependency injection).

For example, im MovieEntry.ux.uno:

public MyApp App;

And when populating the list, make sure you set the App:

foreach (var movie in _movies) 
{
    var ui = new MovieEntry
    {
        App = this,
        ...

Then you can do:

void Activate(object sender, ClickedArgs args)
{
     App.MyTrigger.On = true;
}

You may create an event in MovieEntry and subscribe the event and activate trigger at MyApp.ux.uno.

Thanks! Now I understand! I will try now… :slight_smile:

.