Page 1 of 1
How to load a xaml from external dll
Posted: 01 Apr 2022, 13:28
by peerlessDJ
The external dll (Buttons.dll) includes xaml and cs file
And
The login load the referenced assembly before loading the xaml
I think Assembly.LoadFile is effective
but it can't show the CustomView UI. So how to resolve this issue?
Re: How to load a xaml from external dll
Posted: 04 Apr 2022, 13:04
by sfernandez
In your App class you have to override the CreateXamlProvider to return a xaml provider that can load resources from all your assemblies. By default we provide the EmbeddedXamlProvider class that can chain several providers, for example you can do something like this:
partial class App : Application
{
...
protected override XamlProvider CreateXamlProvider()
{
XamlProvider buttonsProvider = new EmbeddedXamlProvider(Assembly.Load("Buttons"), "Buttons");
Type type = this.GetType();
return new EmbeddedXamlProvider(type.Assembly, type.Namespace, buttonsProvider);
}
}
Re: How to load a xaml from external dll
Posted: 06 Apr 2022, 02:57
by peerlessDJ
thx, it works for me
Re: How to load a xaml from external dll
Posted: 06 Apr 2022, 11:01
by peerlessDJ
Hi, i try it by Android platform. The Buttons.dll is build file of Buttons-android at ManagerSDK. Their build settings is same, but i get the error
So how to resolve this issue?
Re: How to load a xaml from external dll
Posted: 11 Apr 2022, 12:51
by sfernandez
Hi,
The libraries included in the ManagedSDK are xamarin applications and cannot be loaded that way.
The external library should be defined as a Class Library (.netstandard 2.0) and depend on Noesis.GUI for defining your user controls.
Could you tried that?
Re: How to load a xaml from external dll
Posted: 12 Apr 2022, 11:04
by peerlessDJ
Thx for your reply, i loaded a .netstandard2.0 class library and have the same issue
Re: How to load a xaml from external dll
Posted: 12 Apr 2022, 15:59
by sfernandez
Is the class library referenced in the application?
Expand the application project in Visual Studio, right-click on References and select "Add Reference...", then select the class library project.
Otherwise the library won't be included in the android package when building and deploying.
Re: How to load a xaml from external dll
Posted: 13 Apr 2022, 03:35
by peerlessDJ
Is the class library referenced in the application?
Expand the application project in Visual Studio, right-click on References and select "Add Reference...", then select the class library project.
Otherwise the library won't be included in the android package when building and deploying.
but i want to load the class library from storage in android device, please take a look at the screenshot I provided above
Re: How to load a xaml from external dll
Posted: 15 Apr 2022, 05:54
by peerlessDJ
ok, i fixed this issue. Permission Denied
Re: How to load a xaml from external dll
Posted: 15 Apr 2022, 16:12
by jsantos
Great! Thanks for the feedback