Stick Layout in Xamarin Forms to bottom

<StackLayout> <StackLayout Orientation=”Horizontal” VerticalOptions=”Start”> <!– top controls –> </StackLayout> <StackLayout VerticalOptions=”CenterAndExpand”> <!– middle controls –> </StackLayout> <StackLayout Orientation=”Horizontal” VerticalOptions=”End”> <!– bottom controls –> </StackLayout> </StackLayout> Make sure to have no more than one child with Expand options for best performance.

How to use Push Notifications in Xamarin Forms

I just implemented push notification a few days ago, and I’ll share my solution here (based on PushSharp) Step by step guide: 1) In your shared project, create an Interface called IPushNotificationRegister public interface IPushNotificationRegister { void ExtractTokenAndRegister(); } This interface is used for fetching the push token and then send it to the server. … Read more

How to change application icon in Xamarin.Forms?

Updating Icon and Name (Android) If you changed the icon file name please ensure you update the Icon reference in MainActivity.cs: [Activity(Label = “MyName”, Icon = “@mipmap/myicon”, Theme = “@style/MainTheme”] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { } You should also update the names of icon.xml and icon_round.xml in the mipmap-anydpi folder to match to new … Read more

In Xamarin.Forms Device.BeginInvokeOnMainThread() doesn’t show message box from notification callback *only* in Release config on physical device

Here’s an answer that will work, but as @JamesMallon has mentioned, don’t use it: Device.BeginInvokeOnMainThread(ShowAlertAndWaitForUser(currentFabricCount).Result); Your issue is very common in situations where the code is not run in the Main/UI thread. It seems that you begin the invoke on the main thread but the UI thread doesn’t actually read the line, and another thread … Read more

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>