[Suggestion] XAML-based UI 🤩

I suggest implementing XAML support for UI stuff in FiveM, as an alternative to the NUI, along with some basic controls.

Not sure whether this is possible tho, but if it’s not possible to make it using the existing tools, it could be an option to write a custom parser.

The main issue with NUI is having to deal with an additional language (javascript) to make it work. Instead, if FiveM had an internal XAML engine, you could simplify communication between the script and the UI.

I imagine something like the following (imaginary concept code):

LoginForm.xaml

<Page Width="100%" Height="100%">
    <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
        <Label>Login</Label>
        <PasswordField Id="passwordField1"></PasswordField>
        <Button OnClick="OnLoginClick">Login</Button>
    </StackPanel>
</Page>

Which gets automatically compiled on server startup.

LoginScript.cs

[XAMLEvent("LoginForm/OnLoginClick")]
public void OnLoginClick(object sender, ClickEventArgs e)
{
    XAMLPage page = sender as XAMLPage;
    PasswordField field = page.FindUIElement("passwordField1");
    var password = field.Content;

    // do login stuff here
}

And of course, a Lua and Javascript API to handle it too.

1 Like

…?

Much better than me having to maintain a whole UI framework next to the project itself.

1 Like

:yum: