Uno Binding programmatically in c#

145 Views Asked by At

Does anyone know how to do binding for Uno programmatically in c#?

I found some sample code from:
(https://platform.uno/docs/articles/uno-development/Uno-UI-xBind-architecture.html)

which has:

c18.SetBinding(
    global::Windows.UI.Xaml.Controls.TextBlock.TextProperty, 
    new Windows.UI.Xaml.Data.Binding{ 
        Mode = global::Windows.UI.Xaml.Data.BindingMode.OneWay,
    }
    .Apply(___b => 
        global::Uno.UI.Xaml.BindingHelper.SetBindingXBindProvider(
            ___b, // The binding to update
            this, // The DataContext
            ___ctx => Add(InstanceDP, MyxBindClassInstance.MyIntProperty), // the code to execute
            new [] {"InstanceDP", "MyxBindClassInstance.MyIntProperty"} // The properties to observe
        )
    )
);

But it doesn't work in practice.

sample code

0

There are 0 best solutions below