Xamarin Forms: How to add multiple init codes at a time in App.xaml.cs for UWP?

大兔子大兔子 提交于 2020-01-16 17:31:06

问题


I have init codes of both circle image and pop up image in App.xaml.cs. Only the first code is working, the code after Xamarin.Forms.Forms.Init is not working. My current code is adding below:

   //ImageCircle
   var rendererAssemblies = new[]
    {
        typeof(ImageCircleRenderer).GetTypeInfo().Assembly
    };
    Xamarin.Forms.Forms.Init(e, rendererAssemblies);

    //Popup
    Rg.Plugins.Popup.Popup.Init();
    Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());

Now image circle is working and pop up image is not working, how to add multiple init codes at a time?

Thanks in advance.


回答1:


Try this:

//ImageCircle
var rendererAssemblies = new List<Assembly>
{
    typeof(ImageCircleRenderer).GetTypeInfo().Assembly
};

rendererAssemblies.AddRange(Rg.Plugins.Popup.Popup.GetExtraAssemblies());

//Popup
Rg.Plugins.Popup.Popup.Init();
Xamarin.Forms.Forms.Init(e, rendererAssemblies);


来源:https://stackoverflow.com/questions/51758644/xamarin-forms-how-to-add-multiple-init-codes-at-a-time-in-app-xaml-cs-for-uwp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!