Hi!
I would like to write an app only with Uno and UX without FuseJS. I know i will lose the preview of JS-Code because Uno is compiled. I tried first steps but could not use DataBinding with Uno. Event handler works but text changes only in dotnet-preview. Do you have an example how to change/set properties (DataBinding)?
General Questions about Uno:
- Is Ux necessary to write an Uno application in general? (Main method as starting Point?)
- Would it be possible to write an Fuse app only with Uno? (imperative vs declarative)
- What is the right class to fetch data? (HttpMessageHandlerRequest.SendAsync)
- Does Uno-code behind run in a separate thread?
using Uno;
using Uno.Collections;
using Fuse;
public partial class MainView {
Fuse.Controls.Button but11 { get; set; }
Fuse.Controls.Button but22 { get; set; }
Uno.UX.IPropertyListener propList { get; set; }
public MainView() {
debug_log("App init!");
InitializeUX();
Predicate<Node> predicate = findNode;
this.propList = new PropListener();
IList<Node> nodes = this.Children;
this.but11 = (Fuse.Controls.Button)nodes[0];
this.but11.AddPropertyListener(this.propList);
debug_log(nodes[0]);
Node n = App.Current.RootViewport.FindNodeByName(new Uno.UX.Selector("but2"), predicate);
this.but22 = (Fuse.Controls.Button)n;
Fuse.Gestures.Clicked.AddHandler(but1, this.buttonHandler);
}
public void buttonHandler(object o, Fuse.Gestures.ClickedArgs args) {
this.but11.SetText("Test", this.propList);
debug_log(o);
debug_log(args.GetType());
}
public bool findNode(Node n){
return true;
}
public class PropListener: Uno.UX.IPropertyListener {
public void OnPropertyChanged(Uno.UX.PropertyObject obj, Uno.UX.Selector property ) {
}
}
<App ux:Class='MainView' ux:Name='main' ux:AutoCtor="false">
<Button Text="Info" ux:Name='but1' Alignment="TopLeft"/>
<Button Text="Quit" ux:Name='but2' Alignment="TopCenter"/>
</App>