- peerlessDJ
- Posts: 34
- Joined:
How to load a xaml from external dll
The external dll (Buttons.dll) includes xaml and cs file
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?
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?
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: How to load a xaml from external dll
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:
Code: Select all
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);
}
}
- peerlessDJ
- Posts: 34
- Joined:
Re: How to load a xaml from external dll
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?-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: How to load a xaml from external dll
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?
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?
- peerlessDJ
- Posts: 34
- Joined:
Re: How to load a xaml from external dll
Thx for your reply, i loaded a .netstandard2.0 class library and have the same issue
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: How to load a xaml from external dll
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.
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.
- peerlessDJ
- Posts: 34
- Joined:
Re: How to load a xaml from external dll
but i want to load the class library from storage in android device, please take a look at the screenshot I provided aboveIs 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.
- peerlessDJ
- Posts: 34
- Joined:
Re: How to load a xaml from external dll
ok, i fixed this issue. Permission Denied
Re: How to load a xaml from external dll
Great! Thanks for the feedback
Who is online
Users browsing this forum: Semrush [Bot] and 84 guests