I’m trying to implement a custom native control, however, the examples contained in https://www.fusetools.com/docs/native-interop/native-ux-components don’t work. I can compile the file .uno
containing the MySlider
component (for Android), but when I add the following snippet :
namespace MyWrappers.Android
{
extern(!Android) public class MySlider: LeafView
{
public float Value { get; set; }
}
}
the following message appears : There is nothing named 'LeafView' accessible in this scope. Did you perhaps misspell 'ILeafView' (as in 'Fuse.Controls.Native.ILeafView')? Could you be missing a package reference?
Fine, the documentation is wrong. After fixing it, the next uno build -t android
gives me the following:
> uno build -t android
Uno 0.29.20 (build 2873) OS X 10.11 i386 eb56555
Configuring
MainView.ux(6): E8001: Fuse.Controls.PropertyBinding`1<float> cannot be used here, because there are no suitable parent nodes in this scope.
MainView.ux(6): E8001: 'MySlider does not expose a bindable property called 'AndroidTemplate'
MainView.ux(9): E8001: 'MySlider does not expose a bindable property called 'GraphicsTemplate'
(6.98s)
Build completed in 6.98 seconds.
0 Warning(s)
3 Error(s)
The MainApp.ux
is below:
<App>
<StackPanel>
<Control ux:Class="MySlider">
<float ux:Property="Value" />
<MyWrappers.Android.MySlider ux:Generate="Template" ux:Binding="AndroidTemplate" Value="{Property this.Value}" />
<!-- <MyWrappers.iOS.MySlider ux:Generate="Template" ux:Binding="iOSTemplate" Value="{Property this.Value}" /> -->
<Text ux:Generate="Template" ux:Binding="GraphicsTemplate">
MySlider is not available in this context.
</Text>
</Control>
<Text> HEY! </Text>
</StackPanel>
</App>
So, what should I do to implement a native control?