Xamarin.Forms – InitializeComponent doesn’t exist when creating a new page

UPDATE: This error doesn’t usually appear in VS 2015, if it does, here’s my original answer: Found the solution! Right click on the .XAML file, select Properties. You will see a Property called Custom Tool. Change its value from MSBuild:Compile to MSBuild:UpdateDesignTimeXaml This will solve the problem. Dont know about the downvote, but here’s my … Read more

Xamarin.Forms ListView: Set the highlight color of a tapped item

In Android simply edit your styles.xml file under Resources\values adding this: <resources> <style name=”MyTheme” parent=”android:style/Theme.Material.Light.DarkActionBar”> <item name=”android:colorPressedHighlight”>@color/ListViewSelected</item> <item name=”android:colorLongPressedHighlight”>@color/ListViewHighlighted</item> <item name=”android:colorFocusedHighlight”>@color/ListViewSelected</item> <item name=”android:colorActivatedHighlight”>@color/ListViewSelected</item> <item name=”android:activatedBackgroundIndicator”>@color/ListViewSelected</item> </style> <color name=”ListViewSelected”>#96BCE3</color> <color name=”ListViewHighlighted”>#E39696</color> </resources>

The SSL connection could not be established

Yes, you can Bypass the certificate using below code… HttpClientHandler clientHandler = new HttpClientHandler(); clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; }; // Pass the handler to httpclient(from you are calling api) HttpClient client = new HttpClient(clientHandler);

PushAsync is not supported globally on Android, please use a NavigationPage – Xamarin.Forms

You are calling “PushAsync”: public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } private void btnCourseList_Clicked(object sender, EventArgs e) { Navigation.PushAsync(new PageB()); } } but you did not start the NavigationPage, which normally is done in the App.cs class, or at least it should be started before any call to “PushAsync”: MainPage … Read more

Toast equivalent for Xamarin Forms

There is a simple solution for this. By using the DependencyService you can easily get the Toast-Like approach in both Android and iOS. Create an interface in your common package. public interface IMessage { void LongAlert(string message); void ShortAlert(string message); } Android section [assembly: Xamarin.Forms.Dependency(typeof(MessageAndroid))] namespace Your.Namespace { public class MessageAndroid : IMessage { public … Read more

How do you switch pages in Xamarin.Forms?

Xamarin.Forms supports multiple navigation hosts built-in: NavigationPage, where the next page slide in, TabbedPage, the one you don’t like CarouselPage, that allows for switching left and right to next/prev pages. On top of this, all pages also supports PushModalAsync() which just push a new page on top of the existing one. At the very end, … Read more

What is the difference between Xamarin.Forms and Xamarin Native? [closed]

Xamarin.Forms Pros Create one UI for all platforms Use basic components that are available on all platforms (like Buttons, Textfields, Spinners etc.) No need to learn all the native UI frameworks Fast cross platform development process Custom native renderers give you the ability to adjust the appearance and feeling of controls Cons It’s still a … Read more

What is the difference between Xamarin.Form’s LayoutOptions, especially Fill and Expand?

Short answer Start, Center, End and Fill define the view’s alignment within its space. Expand defines whether it occupies more space if available. Theory The structure LayoutOptions controls two distinct behaviors: Alignment: How is the view aligned within the parent view? Start: For vertical alignment the view is moved to the top. For horizontal alignment … Read more