Reputation: 1472
In Xamarin.Android I can write:
SetContentView(Resource.Layout.Main);
for set the activity content from Main.axml
How I can do the same for Xamarin.Forms? How I can move data from Main.axml on main page?
Page page = App.GetMainPage();
page.SetContentView(Resource.Layout.Main); // page doesn't contain method SetContentView
Upvotes: 1
Views: 2628
Reputation: 2434
You should check out Custom Renderers. That is the way we can include platform specific view in Xamarin.Forms. You will need to implement PageRenderer to implement an Activity layout.
Upvotes: 1
Reputation: 45173
A Xamarin.Forms.Page
is platform independent. You try to call the Android specific method SetContentView()
on it. That can't work. When you want to set the layout you can either use XAML or set the Content
of a ContentPage
in code.
You can not use AXML Layouts in Xamairn.Forms.
Take a look here: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/getting-started/ and here http://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/pages/
Upvotes: 0