1

I would like to know if it's possible to create a page that I can include (such as a fragment in Android) into a gridView. I also want to know if I can interact with it from my current page/activity?

Xamarin, Visual Studio 2015, Non-Shared Project

PS: Three differents views (Androïd, iOS & WinPhone) using common models.

Schema

I want some uses that will never change (these will be in the rest of space doesn't filled by the black fragment) and some "fragment using" such as Android in the specified fields (fields == GridView)

Thank for read and help !

Emixam23
  • 3,854
  • 8
  • 50
  • 107
  • Can you be a bit more specific – Sreeraj Apr 21 '16 at 03:24
  • And with this edit? :) – Emixam23 Apr 21 '16 at 03:53
  • 1
    When you say "shared page", are you talking about a `Xamarin.Form` page, or native controls (say within a `Fragment` or a `UIView`)? – SushiHangover Apr 21 '16 at 07:14
  • I want something like a fragment in Android you know, but crossplatform and then share it :/ This fragment can then be into a defined grid view, space, etc. Itt's juste that my app is different for each platform, but I have some same functionnalities and then, I want not to duplicate it and juste put it into the desired grid – Emixam23 Apr 21 '16 at 12:53
  • 1
    If you are using `Xamarin.Forms` to drive your cross-platform app, yes you are share a class from an project that defines a some controls and then instantiate that class and add it to a `Page` that is in another project. – SushiHangover Apr 21 '16 at 17:57
  • But it's a Mono project with some class shared.. I'm not sure to understand your answer, I'm pretty new at Xamarin :/ – Emixam23 Apr 22 '16 at 08:29

1 Answers1

0

I got an answer without answering the question here :)

So, the trick I found is to make a Shared Project. Design it how you want and then, if you want to add some controls depending of the device OS, juste use a switch on it !

switch (Device.OS) {
    case TargetPlatform.Android:
        //Your code
        break;
    case TargetPlatform.iOS:
        //Your code
        break;
    //etc etc
}

Documentation here

You can also use a "if" statement as I need in my question above to just add what you need in a specific platform

Emixam23
  • 3,854
  • 8
  • 50
  • 107