visual studio - Using self created dll in Xamarin.Forms showing white screen on device -
i trying create , use dll in xamarin.forms project. given in charles petzold's book 'creating mobile apps using xamarin.form'. gives following method access library have created
"from pcl project of application solution, add reference library pcl assembly dynamic-link library generated library project"
my library project this
file: hslcolorextension.cs
using system; using xamarin.forms; using xamarin.forms.xaml; namespace xamarin.formsbook.toolkit { public static class toolkit { public static void init() { } } public class hslcolorextension : imarkupextension { public hslcolorextension() { } public double h { set; get; } public double s { set; get; } public double l { set; get; } public double { set; get; } public object providevalue(iserviceprovider serviceprovider) { return color.fromhsla(h, s, l, a); } } } the actual project customextensiondemo in mainpage.xaml is
<?xml version="1.0" encoding="utf-8" ?> <contentpage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:toolkit="clr-namespace:xamarin.formsbook.toolkit;assemby=xamarin.formsbook.toolkit" x:class="customextensiondemo.mainpage"> <stacklayout> <label text="utkarsh"> <label.backgroundcolor> <toolkit:hslcolorextension h="0" s="1" l="0.5"/> </label.backgroundcolor> </label> </stacklayout> </contentpage> the method how added dll application library took path generated dll c:\users\admin\desktop\xamarin.formsbook.toolkit\xamarin.formsbook.toolkit\obj\debug name of dll xamarin.formsbook.toolkit.dll 
i added reference actual project. browsed path c:\users\admin\desktop\xamarin.formsbook.toolkit\xamarin.formsbook.toolkit\obj\debug , added dll : xamarin.formsbook.toolkit.dll 
everything compiled correctly but getting complete white screen on android phone having . points: 1. have set mainpage.xaml mainpage in app.xaml.cs.. have tried put label without property element syntax , worked.
i have not checked on ios think there have same problem problem in method of using dll in application. ide:vs 2017
the error discussed in below discussion 
now require way remove "windows phone silverlight 8.1" , not give option remove that. 
i'm problem incompatible targets of pcl.
instead of adding reference browsing dll, add selecting project. approach check compatibility of dll. need change targets, fool around nuget, etc.
secondly recommend first platform testing uwp. there seems better diagnostics on uwp. when tried code, got white screen on android, when using uwp platform got exception said hslcolorextension not found in dll.
Comments
Post a Comment