Forum Xamarin.Forms

Confused about Xamarin Form Labs

ErezKatzErezKatz CZMember ✭✭


I am trying to get started with Xamarin Form Labs, with my first goal to get the Device resolution, size and dpi.
I added the Forms Labs Core package to my Android project, as well as the IoC package, using the package manager.

However, the compiler still complains that
" The type or namespace name `XLabs' could not be found. Are you missing an assembly reference? (CS0246)"

I saw on the samples project that the actual IoC DLL is in the references folder. But I want to refrain from manually adding DLLs that can soon get stale, after all, the whole point is to let the package manager pick up updates, right?

What am I missing here?




  • ErezKatzErezKatz CZMember ✭✭

    Also, as you can see, in the attached image, there is a reference , "from packages", in the project, but still
    "using XLabs.Ioc;"
    is highlighted in red as an error

  • SKallSKall USMember ✭✭✭✭

    @ErezKatz‌ Did you install all of them from NuGet? The NuGet packages should be on version 1.2.1 which does not have any XLabs packages. The IoC interface is in the Xamarin.Forms.Labs DLL.

  • ErezKatzErezKatz CZMember ✭✭
    edited November 2014

    @SKall - thank you for replying.
    Yes, I right-clicked on "packages" and selected Xlabs core.
    On the other hand, I noticed that I am on version 1.2.0 (see attached image).
    Should I use a different source than "Official NuGet Gallery" - the latest version there is 1.2.0?

    Is there a page that has all the getting up & running instructions in one place ?
    I followed the short wiki, it just says to add the Core package.

  • SKallSKall USMember ✭✭✭✭

    So is the problem that you are trying to use "using XLabs.Ioc;"? If that is the case then use "using Xamarin.Forms.Labs.Services;" instead as that is where the IOC portion is located on the NuGet releases.

  • ErezKatzErezKatz CZMember ✭✭

    Yup - it works now - thank you !

    I saw that "using XLabs.Ioc;" in the Labs samples ... and that probably what threw me off....
    This is what I was looking at :

    Which is called from here: and this one does use have the "using XLabs.Ioc" statement.
    To be honest, I followed the path to App.cs because the ExtendedDeviceInfoPage is created with an IDevice instance passed from the App which uses XLabs.Ioc.

    On my own project it is enough to have the following:
    using Xamarin.Forms;
    using Xamarin.Forms.Labs;
    using Xamarin.Forms.Labs.Services;

    and then followed by:

    Device device = Resolver.Resolve ();
    var w= device.Display.Width;

    This at least compiles.

    On the other hand, in the samples, that is not the case, I tried to de-couple the ExtendedDeviceInfoPage.cs from the App and it couldn't find the Resolver class (see attached photo).
    So while I am happy I got it to work on my own project, I think the distributed samples should be more inline with the official release (or being a newbie, to Xamarin, I may have missed something along the way).

  • SKallSKall USMember ✭✭✭✭

    When you are working with the NuGet packages you should pull down the 1.2.1 branch:

    I will try to get the Wiki updated to minimize confusion. We are doing major refactoring of the codebase to separate the non-Forms stuff for those who don't use Forms. This will be a 2.0 release once it has been completed.

  • ErezKatzErezKatz CZMember ✭✭

    I am using the official release channel which is currently up to 1.2.0 (see current screenshot)
    What should I do in order to have access to 1.2.1 from the ?

  • SKallSKall USMember ✭✭✭✭

    You don't need to. Just use either 1.2 or 1.2.1 of the source code as samples as the project structure on those has not changed.

Sign In or Register to comment.